
delphi firemonkey win注册全局热键相关话题近期引发广泛关注,我们特别整理了多维度信息,希望能为您提供有价值的参考。
private aatom:atom; c:atom; procedure hotkey(var msg:tmessage);message wm_hotkey; //定义全局热键消息事件 { Private declarations } public { Public declarations } end;var Form1: TForm1;a,b:integer;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);beginaatom:=globaladdatom('hotkey');c:=globaladdatom('hotkey1'); //全局热键IDRegisterHotKey(handle,aatom,MOD_ALT,vk_f12); //注册全局热键RegisterHotKey(handle,c,MOD_ALT,vk_f11);end;procedure TForm1.hotkey(var msg:tmessage); //热键响应事件begin if (msg.LParamHi=VK_F12) and (msg.LParamLo=MOD_ALT) then //全局热键 ALT+F12 begin a:=a+1; a:=a mod 2; if a=1 then checkbox1.Checked:=true else checkbox1.Checked:=false end; if (msg.LParamHi=VK_F11) and (msg.LParamLo=MOD_ALT) then b:=b+1; b:=b mod 2; if b=1 then checkbox2.Checked:=true else checkbox2.Checked:=falseend;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);beginglobalDeleteatom(aatom);globalDeleteatom(c);end;以前写的 改下就行了
以上就是关于delphi firemonkey win注册全局热键的全部介绍,如果觉得有用,请收藏本站。