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;
}
}
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;
}
}
To copy to clipboard, switch view to plain text mode
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;
}
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;
}
To copy to clipboard, switch view to plain text mode
but I don't know what to do later to make it able to catch the system/global hot keys.
Bookmarks