Search code examples
windowsmessagewindows-messages

Why do some windows not receive Windows messages


Using Spy++ tool on Visual Studio I can see that windows like the Desktop or Explorer(The File Explorer thing) receive WM_ messages, but windows like Firefox or Visual Studio do not receive messages.

Why do some receive messages and others don't.

(By WM_ messages, I mean things like, WM_MOUSELEAVE or WM_SETCURSOR)


Solution

  • Spy++ needs to inject a hook to monitor window messages. For this to work, the bitness of the hook function needs to match the bitness of the process owning the window, and therefore you should use the 32-bit version of Spy++ to monitor windows of 32-bit apps, and the 64-bit version to monitor 64-bit apps.

    (That is, after all, why two versions of Spy++ get installed)