非常感谢晶晶!!!!!!!<br><br>我刚学delphi没几天,很菜啊<br>我这里有程序,是f12激活的code,没用dll<br><br>继续问:<br>我现在想做的是,把下面这个程序改成用户用hotkey控件可以及时自定义快捷健...<br>就是用HOTKEY控件读入快捷键,然后将其SCANCODE赋与key,我想这就应该可以实现了<br>我用showmessage(inttostr(hotkey1.HotKey));查看SCANCODE的,查出F12是123,确实可以实现<br>CTRL+ALT+X的SCANCODE 是49240,我把KEY:=123 改成KEY:=49240后,用C-A-X却无法激活程序,不知何故?<br><br>//code<br>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> procedure FormCreate(Sender: TObject);<br> procedure FormClose(Sender: TObject; var Action: TCloseAction);<br> private<br> procedure WMHotKey(var Msg : TWMHotKey); message WM_HOTKEY;<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br> ID:integer;<br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>var key:integer;<br>begin<br> id:=GlobalAddAtom('MyHotkey');<br> key:=123;//scancode of F12 is 123<br> RegisterHotKey(handle,id,0,key);<br>end;<br><br>procedure TForm1.WMHotKey (var Msg : TWMHotKey);<br>begin<br> if msg.HotKey = id then showmessage('You pressed F12');<br>end;<br>procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);<br>begin<br> UnRegisterHotKey(handle,id);<br> GlobalDeleteAtom(id);<br>end;<br><br>end. <br>