usesWindowsMenus;
.....
Statement
Hotkey_key:word;
Hotkey_shift:word;
procedureWmhotkey (var msg:tmessage); Message Wm_hotkey;
......
functionShiftstatetoword (shift:tshiftstate): Word;
Begin
If ssshift in Shift and result: =mod_shift else result: = 0;
If Ssctrl in Shift and Result: =result or Mod_control;
If Ssalt in Shift and then Result:=result or Mod_alt;
End
Realize
procedureTform1.wmhotkey (var msg:tmessage);
Begin
if ((Msg.lparamhi = Hotkey_key) and (Msg.lparamlo = Hotkey_shift) Then
Begin
Do someting .....
End
End
Register Hotkey
procedureTform1.hotkey1change (Sender:tobject);
var ss:tshiftstate;
Begin
Aatom: = Globaladdatom (' ea7276ec-34c1-4a11-8cb3-9940fc76539d '); Global Hotkey ID
Shortcuttokey (Hotkeyset.hotkey, Hotkey_key, SS);
Hotkey_shift: = Shiftstatetoword (SS);
RegisterHotKey (Handle, Aatom, Hotkey_shift, Hotkey_key); Registering a global Hotkey
End
Cancel a registered Hotkey
procedure Tform1.formdestroy (Sender:tobject);
Begin
Unregisterhotkey (Handle, Aatom);
Globaldeleteatom (Aatom);
End
Delphi Registration Hotkey Method (i)