以下是F9,F10完整实现:<br><br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;<br><br>type<br> TForm1 = class(TForm)<br> procedure FormCreate(Sender: TObject);<br> procedure FormDestroy(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> procedure WMHotKey(var Msg : TWMHotKey); message WM_HOTKEY;<br> end;<br><br>var<br> Form1: TForm1;<br> F9_ID,F10_ID:integer;<br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> if GlobalFindAtom('MyF9HotKey') = 0 then<br> begin<br> F9_ID:=GlobalAddAtom('MyF9HotKey');<br> RegisterHotKey(handle,F9_id,0,VK_F9);<br> end;<br> if GlobalFindAtom('MyF10HotKey') = 0 then<br> begin<br> F10_ID:=GlobalAddAtom('MyF10HotKey');<br> RegisterHotKey(handle,F10_id,0,VK_F10);<br> end ;<br>end;<br><br>procedure TForm1.FormDestroy(Sender: TObject);<br>begin<br> UnRegisterHotKey(handle,F9_id);<br> GlobalDeleteAtom(F9_id);<br> UnRegisterHotKey(handle,F10_id);<br> GlobalDeleteAtom(F10_id);<br>end;<br><br>procedure TForm1.WMHotKey(var Msg: TWMHotKey);<br>begin<br> if msg.HotKey = F9_id then form1.hide;<br> if msg.HotKey = F10_id then form1.show;<br>end;<br><br>end.<br>