9

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)

JackBarn
  • 635
  • 1
  • 6
  • 18
  • What version of Windows? Are you running Spy++ elevated? UIPI might prevent Spy++ from monitoring some windows. – Ben Voigt Mar 01 '15 at 04:09
  • I'm using Spy++ (64) on Windows 64bit. – JackBarn Mar 01 '15 at 04:10
  • My guess was that some windows just don't receive WM_ messages – JackBarn Mar 01 '15 at 04:11
  • Well, Visual Studio is not a 64-bit process, and most firefox installs are not either. Try with Spy++ (32-bit). – Ben Voigt Mar 01 '15 at 04:11
  • 3
    All windows receive those messages. Because you're not seeing them doesn't mean they don't exist; it simply means you're not seeing them. Every window created on the Windows OS receives `WM_` messages; they're the basis of the entire Windows user interface API. Your "guess" is incorrect. – Ken White Mar 01 '15 at 04:20
  • @Ben Voigt Using the 32bit version of Spy++ worked. You should post an answer – JackBarn Mar 01 '15 at 04:21
  • @KenWhite: Your comment would have been true back in Windows 7. Now, window messages are the basis only for the "desktop" portion of the Windows user interface. – Ben Voigt Mar 01 '15 at 04:35
  • 2
    @Ben: *Windows like the Desktop or Explorer (the File Explorer)...Firefox or Visual Studio* - what part of that isn't the "desktop" portion of the Windows UI? – Ken White Mar 01 '15 at 04:46
  • They are the desktop portion, but the desktop portion is no longer the "entire Windows user interface" as your comment suggested. – Ben Voigt Mar 01 '15 at 06:35

2 Answers2

23

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)

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • 10
    What a SHAME that Microsoft is programming so sloppy that they do not display an error message if the bitness does not match! "To capture the messages of this window you need the 64 bit version of Spy++". – Elmue Mar 17 '17 at 13:40
1

I am running VS 2017 on 64bit windows. I used spy++ from the IDE tools menu but it do not log messages. And then I see the answer of Ben Voigt and check the version and it's a x86 version. And the vs 2017 ide is in a program files(x86) directory. So I look around try to download a x64 version of spy++ and failed. And I can not choose x86 or x64 when I try to install a vs2019. Finally I found there is a spy++ x64 version spyxx_xxx64.exe in the same directory of the spy++ x86 version. The tools menu somehow picked the wrong one. So if you run into same problem as me, just find and pin the x64 version of spy++ somewhere.

rml
  • 803
  • 10
  • 14