Hello!
I use class which inherits QApplication and implements its own winEventFilter(MSG* msg, long* result) to capture WM_INPUT messages and to process raw input data from keyboard in Qt 4.8.4.
Qt Code:
  1. bool Application::winEventFilter(MSG *msg, long *result)
  2. {
  3. UINT dwSize;
  4. WCHAR keyChar;
  5. switch(msg->message)
  6. {
  7. case WM_INPUT:
  8. {
  9. if (GetRawInputData((HRAWINPUT)msg->lParam,
  10. RID_INPUT,
  11. NULL,
  12. &dwSize,
  13. sizeof(RAWINPUTHEADER)) == -1) return false;
  14. LPBYTE lpb = new BYTE[dwSize];
  15. if (lpb == NULL) return false;
  16. if (GetRawInputData((HRAWINPUT)msg->lParam,
  17. RID_INPUT,
  18. lpb,
  19. &dwSize,
  20. sizeof(RAWINPUTHEADER)) != dwSize)
  21. {
  22. delete[] lpb;
  23. return false;
  24. }
  25. PRAWINPUT raw = (PRAWINPUT)lpb;
  26. UINT Event;
  27. Event = raw->data.keyboard.Message;
  28. keyChar = GetSymbol(raw->data.keyboard.VKey);
  29. char keyCharLO = (char)keyChar;
  30. delete[] lpb;
  31. if (!iswprint(keyChar))
  32. return false;
  33. // process data from keyboard
  34. keyStrokeHandle->ProcessNextKeyStroke(Event, keyChar);
  35.  
  36. *result = 0;
  37. QApplication::winEventFilter(msg, result);
  38. return true;
  39. }
  40. default:
  41. {
  42. return false;
  43. }
  44. }
  45. }
To copy to clipboard, switch view to plain text mode 
After RegisterRawInputDevices call, application starts to recieve WM_INPUT messages.
The problem is: when user types in qt application, data from keyboard don't get to input which is used to type data, it is "blocked" by winEventFilter.
According to Qt Documentation:
If you don't want the event to be processed by Qt, then return true and set result to the value that the window procedure should return. Otherwise return false.
And MSDN:
Return value
If an application processes this message, it should return zero.
But I can't receive my input in application whether I return true/false from winEventFilter, change *result value or invoke inhedited QApplcation::winEventFilter.
What do I have to do to get data in application after WM_INPUT processing?