private
{ Private declarations }
HotKeyId1: Integer;
{ Private declarations }
HotKeyId1: Integer;
procedure HotKeyDown(var Msg: Tmessage); message WM_HOTKEY;
procedure TForm1.FormCreate(Sender: TObject);
begin
HotKeyId1 := GlobalAddAtom('MyHotKey1') - $C000;
RegisterHotKey(Handle, hotkeyid1,0, VK_F1);
end;
procedure TForm1.HotKeyDown(var Msg: Tmessage);
begin
if Msg.LParamHi = VK_F1 then
ShowMessage('F1');
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
UnRegisterHotKey(handle, HotKeyId1); //注销HotKey,
Action := caFree;
end;