孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

加一过程procedure WMhotkeyhandle(var msg:TMessage); message wm_hotkey;

procedure TForm1.WMHotkeyhandle(var msg:TMessage);

begin

if (msg.LParamHi=$41) and (msg.LParamLo=NOD_CONTROL or mod_Alt) then

begin

msg.Result :=1;

Application.BringToFront;

end;

end;

//注册热键

procedure TForm1.FormCreate(Sender:TObject);

begin

hotkeyid :=GlobalAddAtom(pchar('UserDefineHotkey'))-$C000;

registerhotkey(handle,hotkeyid,MOD_CONTROL or mod_Alt,$41);

end;

//释放热键

procedure TForm1.FormClose(Sender:TObject;var Action:TCloseAction);

begin

unregisterhotkey(handle,hotkeyid);

DeleteAtom(HotKeyID);

end;

本例程设置热键Ctrl+Alt+A,当按下此热键后,将窗体置于最前,关闭窗体时释放热键

posted on 2008-09-14 14:08  孤独的猫  阅读(162)  评论(0编辑  收藏  举报