□给程序加上热键
HotKeyID:=GlobalAddAtom(pchar("a string"));//返回一个独一无二的数.
RegisterHotKey(handle,HotKeyID,MOD_CONTROL or MOD_Alt,$41);
//注册热键为ctrl+Alt+A (MOD_CONTROL,Mod_Alt,Mod_Shift,Mod_win)
procedure WMhotkeyhandle(var msg:Tmessage);message wm_hotkey;//响应敏感键按键消息
procedure TForm1.Wmhotkeyhandle(var msg:Tmessage);
begin
if (msg.LParamHi=$41) and (msg.lparamLo=MOD_CONTROL or mod_Alt) then
begin
msg.Result:=1; //该消息已经处理
application.BringToFront;
//把窗口最前面显示
..........
end;
end;
UnregisterHotKey(handle,HotKeyID); //注销热键
DeleteAtom(HotKeyID);//删除原子