全局组合按键-老板键

2019-04-13 22:05发布

全局组合按键-老板键
//--------------------------------------------------------------------------- int ALT_CTRL_L=0xA76F; void __fastcall TForm1::FormCreate(TObject *Sender) { if (!RegisterHotKey(this->Handle,ALT_CTRL_L,MOD_ALT,VK_F12)) ShowMessage("注册热键失败"); } //--------------------------------------------------------------------------- void __fastcall TForm1::HotMessage(TMessage &Masg) { if (Masg.LParamLo == MOD_ALT ) //按Alt+F12 { if (Masg.LParamHi == VK_F12) { ShowMessage("按了Alt+F12"); // AnsiString Lines = IntToStr(nTimes); } } } //--------------------------------------------------------------------------- void __fastcall TForm1::FormDestroy(TObject *Sender) { if (!UnregisterHotKey(Handle,ALT_CTRL_L)) ShowMessage("撤销热键失败"); }