Qt Windows消息处理-热键注册
2012-07-28 16:09 owenyang 阅读(402) 评论(0) 编辑 收藏 举报1.头文件,重写:
bool winEvent(MSG *msg, long *result);2.注册热键:
::RegisterHotKey(this->winId(), 100,0, VK_F2);3.处理Windows消息:
bool YYKengDieButton::winEvent(MSG *msg, long *result){if(msg->message==WM_HOTKEY){
if(msg->wParam==100)timer->stop();}
return false;}
4.重写关闭事件、卸载热键:
void YYKengDieButton::closeEvent(QCloseEvent *event)
{
::UnregisterHotKey(this->winId(),100);
}