你用下面的registerhotkey的方法注册热键
用GlobalAddAtom('hotkey')得到唯一的一个热键ID
procedure WMHotKey(var Message: TWMHOTKEY); message WM_HOTKEY;
....
procedure TForm1.FormCreate(Sender: TObject);
begin
RegisterHotKey(Handle, GlobalAddAtom('hotkey'), mod_alt, vk_F1);
end;
...
procedure TForm1.WMHotKey(var Message: TWMHOTKEY);
begin
showwindow(Form1.handle,SW_NORMAL);
SetForegroundWindow(Form1.handle);
end;
...
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
UnregisterHotKey(Handle, GlobalAddAtom('hotkey'));
end;