Hi,
I have some problems with winEvent messages. I noticed that my program recieve Windows events only when it's active window. Furthermore for some reason it doesnt recognize some of keyboard keys. Looks like winEventFilter function is going to 'cure' this. I found in qt documentation:
To handle system wide messages, such as messages from a registered hot key, you need to install an event filter on the event dispatcher, which is returned from QAbstractEventDispatcher::instance().
I reimplemented winEvent function in my MainWindow class

mainwindow.h
Qt Code:
  1. ...
  2. private:
  3. virtual bool winEvent(MSG *message, long *result);
  4. ...
To copy to clipboard, switch view to plain text mode 

mainwindow.cpp
Qt Code:
  1. ...
  2. bool MainWindow::winEvent(MSG *message, long *result)
  3. {
  4. switch(message->message)
  5. {
  6. case WM_KEYDOWN:
  7. qDebug("KEYDOWN");
  8. switch(message->wParam)
  9. {
  10. case Qt::Key_A :
  11. qDebug("- A");
  12. break;
  13.  
  14. case Qt::Key_F12 :
  15. qDebug("- F12");
  16. break;
  17. default:
  18. break;
  19. }
  20. break;
  21. default:
  22. return false;
  23. }
  24. return false;
  25. }
  26. ...
To copy to clipboard, switch view to plain text mode 

After pressing A Key:
KEYDOWN
- A
After pressing F12 Key:

KEYDOWN
The problem is my stupidity. I tried many times but failed. I need some small example but there is nothing I believe...

So again: What can I do for my app to recieve winEvents while not active? And why this code can't recognize keys like: F10, F11, F12, PrtSc, Ins, Ctrl? Could you do some tiny example how to handle system wide messages, please?