#include <QtGui/QApplication>#include <QDebug> #include <windows.h> LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam){ // process event... qDebug() << nCode << wParam << lParam; return CallNextHookEx(NULL, nCode, wParam, lParam);} int main(int argc, char *argv[]){ QApplication a(argc, argv); if (SetWindowsHookEx(WH_KEYBOARD_LL, HookProc, qWinAppInst(), NULL) == 0) qDebug() << "Hook failed for application instance" << qWinAppInst() << "with error:" << GetLastError(); return a.exec();}
bool QApplication::x11EventFilter ( XEvent * event ) [virtual]
bool QApplication::x11EventFilter ( XEvent * event )
if (nCode != HC_ACTION ) return CallNextHookEx(NULL, nCode, wParam, lParam);
short stateCtrl = GetAsyncKeyState(VK_CONTROL);short stateShift = GetAsyncKeyState(VK_SHIFT); short stateCtrl = GetAsyncKeyState(VK_MENU);// ALT