Intercept Keyboard Shortcuts

I would like to capture a shortcut pressed even if the Delphi Form doesn't have focus. I am using Delphi 4.
skymagAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LischkeCommented:
..and again hooks. I can't hear it anymore.
0
skymagAuthor Commented:
Hehe! What does your comment mean?
0
LischkeCommented:
:-)) Writing system hooks became so popular recently that I fear too many programs will install those hooks to get at least near system wide control.

Unfortunately, in your case you cannot redirect a hotkey which is already registered with the system other than installing a system wide hook.

That's the whole story :-)

Ciao, Mike
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

skymagAuthor Commented:
Mmmm where can I get a system hook and install it?
0
ronit051397Commented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ronit051397Commented:
0
men xinCEOCommented:
Hi Skymaq:

You neednt use hook,i give you a simple example used Registerhotkey.it can work wonderful.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    procedure OnHotKey(var Message :TWMHotKey); Message WM_HotKey;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
procedure TForm1.OnHotKey(var Message :TWMHotKey);
begin
  showmessage('you have pressed ctrl+F10');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  RegisterHotKey(Handle,10,MOD_CONTROL,VK_F10);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  UnregisterHotKey(Handle,10);
end;


end.

it registered Ctrl+f10.

menxin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.