试试这个!<br>unit Unit1globaladdatom;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs;<br><br>type<br> TForm1 = class(TForm)<br> procedure FormCreate(Sender: TObject);<br> procedure FormDestroy(Sender: TObject);<br> private<br> { Private declarations }<br> procedure HotKeyProc(Var msg:TWMHotKey);message WM_HotKey;<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br> HotKey1:word;<br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> HotKey1:=GlobalAddAtom('nnss');<br> RegisterHotKey(handle,HotKey1,0,VK_F9); //热键是F9<br>end;<br><br>procedure TForm1.FormDestroy(Sender: TObject);<br>begin<br>UnRegisterHotKey(handle,HotKey1)<br>end;<br><br>procedure TForm1.HotKeyProc(var msg: TWMHotKey);<br>begin<br> showmessage('hi');<br>end;<br><br>end.