unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
procedure WMHotKey(var Msg : TWMHotKey); message WM_HOTKEY;
{ Private declarations }
public
{ Public declarations }
end;
const ID_a= ord('A');
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMHotKey(var Msg : TWMHotKey);
begin
if Msg.HotKey = ord('A') then begin
showmessage('A');
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
RegisterHotKey(Form1.Handle, ID_a, 0, ord('A'));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(Form1.Handle, ord('A'));
end;
end.