PDA

View Full Version : HOWTO after I reimplement winEventFilter to catch the global HOTKEY



casual0402
17th March 2010, 18:37
I use the function to register hotkey:


void MyApp::registerGlobalKey(){
if(RegisterHotKey(NULL, 10, 0, VK_F10)){
qDebug("VK_F10.");
std::cout << "VK_F10" << std::endl;
}
if(RegisterHotKey(NULL, 11, 0, VK_F11)){
qDebug("VK_F11.");
std::cout << "VK_F11" << std::endl;
}
}

and it works.

also I reimplement winEventFilter:


bool MyApp::winEventFilter(MSG *msg, long *result){
if(WM_HOTKEY == msg->message){
qDebug("hotkey.");
if(msg->wParam == VK_F10)
qDebug("get F10.");
emit getHotKey();
return true;
}
//qDebug("not hotkey.");
return false;
}


but I don't know what to do later to make it able to catch the system/global hot keys.:confused:

high_flyer
18th March 2010, 08:42
As far as I understand, you have to do the same you did with your own hot keys.
Register them for your application, and catch them in your winEventFilter().