unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> Button2: TButton;<br> Button3: TButton;<br> procedure Button2Click(Sender: TObject);<br> procedure Button3Click(Sender: TObject);<br> private<br> procedure WMHotKey(var Message: TWMHotkey); message wm_hotkey;<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br><br>procedure TForm1.WMHotKey(var Message: TWMHotkey);<br>begin<br> case Message.HotKey of<br> 1: showmessage('1');<br> else<br> Showmessage(inttostr(message.HotKey));<br> end;<br>end;<br><br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br> RegisterHotKey(handle,1,MOD_ALT ,VK_F4); <br>end;<br><br>procedure TForm1.Button3Click(Sender: TObject);<br>begin<br> UnregisterHotKey(handle,1);<br>end;<br><br>end.