private
{ Private declarations }
Aatom: ATOM;
procedure hotkey(var msg: TMessage); message WM_HOTKEY;
procedure TForm1.FormCreate(Sender: TObject);
begin
if FindAtom('ZWXhotKey') = 0 then
begin
Aatom := GlobalAddAtom('ZWXhotKey');
end;
if RegisterHotKey(Handle, Aatom, MOD_ALT, $41) then
begin
MessageBox(Handle, '按alt+a', '提示', MB_OK);
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
UnregisterHotKey(Handle, Aatom);
GlobalDeleteAtom(Aatom);
end;
procedure TForm1.hotkey(var msg: TMessage);
begin
if (msg.LParamHi = $41) and (msg.LParamLo = MOD_ALT) then
begin
showmessage('Ctrl+A');
end;
end;
最后
以上就是安静小天鹅最近收集整理的关于Delphi全局热键注册的全部内容,更多相关Delphi全局热键注册内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复