标签:osc color http menu glob mem let begin code
Demo下载:https://git.oschina.net/xieyimo9/quanjurejian.git
procedure TForm1.HotKey(var msg: TMessage); begin if msg.WParam =FHotKeyId_Alt_Down then Memo1.Lines.Add(‘Alt Down‘) else if msg.WParam =FHotKeyId_Alt_Up then Memo1.Lines.Add(‘Alt Up‘) else if msg.WParam =FHotKeyId_Ctrl_F12 then Memo1.Lines.Add(‘Ctrl + F12‘); end; procedure TForm1.FormCreate(Sender: TObject); begin FHotKeyId_Alt_Down := GlobalAddAtom(‘MyHotKey_Alt_Down‘); { 全局热键ID } RegisterHotKey(Self.Handle, FHotKeyId_Alt_Down, MOD_ALT, VK_MENU); { 注册全局热键 Alt Down } FHotKeyId_Alt_Up := GlobalAddAtom(‘MyHotKey_Alt_Up‘); { 全局热键ID } RegisterHotKey(Self.Handle, FHotKeyId_Alt_Up, MOD_ALT, 0); { 注册全局热键 Alt Up } FHotKeyId_Ctrl_F12 := GlobalAddAtom(‘MyHotKeyCtrl_F12‘); { 全局热键ID } RegisterHotKey(Self.Handle, FHotKeyId_Ctrl_F12, MOD_CONTROL, VK_F12); { 注册全局热键 Ctrl + F12 } end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin UnregisterHotKey(Handle, FHotKeyId_Alt_Down); { 反注册全局热键 } GlobalDeleteAtom(FHotKeyId_Alt_Down); UnregisterHotKey(Handle, FHotKeyId_Alt_Up); { 反注册全局热键 } GlobalDeleteAtom(FHotKeyId_Alt_Up); UnregisterHotKey(Handle, FHotKeyId_Ctrl_F12); { 反注册全局热键 } GlobalDeleteAtom(FHotKeyId_Ctrl_F12); end;
标签:osc color http menu glob mem let begin code
原文地址:http://www.cnblogs.com/xieyimo/p/7133459.html