The following code I compiled under the Delphi XE2
==================================================================
UnitUnit1;Interfaceuseswinapi.windows, Winapi.messages, System.sysutils, System.variants, system.classes, Vcl.graphics, Vcl.Controls, Vcl.forms, Vcl.dialogs, Vcl.extctrls, Vcl.menus;typeTForm1=class(tform) Trayicon1:ttrayicon; //Pallet ControlPm1:tpopupmenu;//Tray MenuN1:tmenuitem; N2:tmenuitem; procedureN2click (Sender:tobject); procedureN1click (Sender:tobject); procedureTrayicon1dblclick (Sender:tobject); procedureformcreate (Sender:tobject); procedureFormclose (Sender:tobject;varaction:tcloseaction); PrivateAatom:atom; procedureHotkeyvarMsg:tmessage);messageWm_hotkey; //defining Global Hotkey Message Events procedureWmsyscommand (varMsg:twmsyscommand);messageWm_syscommand; //Pallet message Definition {Private Declarations} Public {Public Declarations} End;varForm1:tform1;Implementation{$R *.DFM}//Global key Execution procedureprocedureTform1.hotkey (varmsg:tmessage);begin ifTwmhotkey (msg). Hotkey=aatom Then beginTrayicon1dblclick (self); End;End;//Delete Global HotkeyprocedureTform1.formclose (Sender:tobject;varaction:tcloseaction);beginUnregisterhotkey (Handle,aatom); Globaldeleteatom (aatom);End;//Create global Keyproceduretform1.formcreate (sender:tobject);begin ifFindatom ('HotKey')=0 Then beginAatom:=globaladdatom ('HotKey'); End; RegisterHotKey (handle,aatom,mod_alt,$ +);//ALT + CEnd;procedureTform1.n1click (sender:tobject);beginform1.show; Openicon (Form1.handle); //Activate windowEnd;procedureTform1.n2click (sender:tobject);begintrayicon1.visible:= False;//Delete tray iconapplication.terminate;End;procedureTform1.trayicon1dblclick (sender:tobject);begin //Double-click the tray icon to show/hide the window ifWindowState = wsminimized Then beginform1.show; Openicon (Form1.handle); End Else beginForm1.hide; WindowState:=wsminimized; End;End;//window shrinks to pallet execution codeprocedureTform1.wmsyscommand (varMsg:twmsyscommand);begin ifMsg. Cmdtype = Sc_minimize ThenForm1.hide; inherited;End;End.
==================================================================
The code ends.
Delphi Tray/Hotkey "lcemeaning"