在.h中:
public: // User declarations
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_HOTKEY,TMessage,OnHotKey)
END_MESSAGE_MAP(TForm)
void __fastcall TMainForm::OnHotKey(TMessage &Message); //响应热键消息
在.cpp中:
void __fastcall TMainForm::FormCreate(TObject *Sender)
{
//注册系统热键
if(!RegisterHotKey(Handle,2000,MOD_CONTROL,VK_F12))
//这里注册的热键是Ctrl+F12
ShowMessage("热键注册失败");
}
//---------------------------------------------------------------------------
void __fastcall...[ 查看全文 ]