RegisterHotKey注册全局热键注册全局热键//RegisterHotKey注册全局热键注册全局热键
private
{ Private declarations }
procedure HotKeyDown(var Msg: Tmessage); message WM_HOTKEY;
{
var
Form1: TForm1; }创新课堂
HotKeyId:Integer; //声明变量
procedure TForm1.HotKeyDown(var Msg: Tmessage);
begin动物电影
木瓜牛奶冻if (Msg.LparamLo = mod_alt) and (Msg.LParamHi = vk_F3) then
begin
形容坚持的成语>diiif ShowWindow(Self.Handle,SW_SHOW) then ShowWindow(Self.Handle,SW_HIDE) //隐藏⾃⾝窗体
舞蹈教案el ShowWindow(Self.Handle,SW_SHOW) ; //显⽰⾃⾝窗体
大学生学习计划
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
HotKeyId := GlobalAddAtom('MyHotKey') - $C000;
RegisterHotKey(Self.Handle, HotKeyId, MOD_ALT, VK_F3);//
{如果想注册其他热键可以在这⾥继续注册热键}
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
熊用英语怎么说UnRegisterHotKey(Self.Handle, HotKeyId); //注销HotKey, 释放资源。
DeleteAtom(HotKeyId);
end;