Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

[SOLVED]Sytem-wide Hotkey Shortcut(Windows) : Works but locks window?

$
0
0
I am trying to figure a way I can use a system wide hotkey in my application. I have provided working code below but my issue is because it’s in a while() loop. This is causing the windows to lock up and become disabled, however functions still get processed depending on the wParam I set for each hotkey. I will continue to find a way to do this without the loop but figured I could appeal to the community being there is a request for a data type to do this QDesktopShortcut. [bugreports.qt-project.org] #define MOD_NOREPEAT    0x4000 #define MOD_ALT         0x0001   #include "mainwindow.h" #include <QApplication> #include "stdafx.h" #include <QDebug>   int main(int argc, char *argv[]) {     RegisterHotKey(NULL,1,MOD_ALT | MOD_NOREPEAT,0x42);     RegisterHotKey(NULL,2,MOD_ALT | MOD_NOREPEAT,0x44);     MSG msg;     QApplication a(argc, argv);     MainWindow w;     w.show();     while(GetMessage(&msg,NULL,0,0)){         if (msg.message == WM_HOTKEY){             if (msg.wParam == 1)qDebug() << "Hot Key activated : ALT + B";             if (msg.wParam == 2) qDebug() << "Hot Key activated : ALT + D";         }     }     return a.exec(); }

Viewing all articles
Browse latest Browse all 13965

Trending Articles