My goal is to disable some tool-tip-like thing in window of another process. My thoughts are to block WM_MOUSEMOVE
if the coordinates of mouse movement is in certain rectangle of the window.
I can use SetWindowsHookEx
to receive that messages (WH_CALLWNDPROC
and WH_GETMESSAGE
), but it doesn't allow to block them. I can return 1 instead of calling CallNextHookEx
, but it doesn't prevent WndProc of window to receive the message. However, this approach works for blocking events in MOUSE_LL/KEYBOARD_LL.
SetWindowsHookEx
is also not good, because it installs hook to all windows across the system.
How I can prevent window of another process from receiving certain windows messages?
The WH_GETMESSAGE
message hook doesn't let you "block" or cancel the message but you can modify it. So simply change lpMsg->message
to WM_NULL
to prevent the mouse move message from being processed by the target window.