I have successfully installed a WH_GETMESSAGE
hook with SetWindowsHookEx
and I can see the WM_POINTERDOWN
, WM_POINTERUP
etc. messages that the application receives. (It is a 32 bit desktop application running on Windows 8.1.)
Now, I not only want to see those messages, but I want to remove some of them.
The documententation for GetMsgProc says:
The GetMsgProc hook procedure can examine or modify the message. After the hook procedure returns control to the system, the GetMessage or PeekMessage function returns the message, along with any modifications, to the application that originally called it.
With WM_KEYUP
messages this seem to work fine. I can set the message to WM_NULL
in the hook, and the key event will disappear.
With WM_POINTER...
messages however, this does not seem to work. The application still receives the messages (validated in the debugger).
Maybe there is some other way to filter/remove such messages?
Edit: It has to work with unmodified third-party applications (hence the usage of a hook).
Update: I managed to prevent click events from touch by aggressively calling PeekMessage
within the hook (probably not a good idea in the long term). However, I still can't prevent scrolling by touch.