How do I view information about a HWND within visual studio while debugging?
Asked Answered
B

1

7

Are there any well known tools or plugins I can use to get properties about HWNDs while debugging / stepping through Visual Studio? I know I can use Spy++ for these things, but it's cumbersome to do so while also stepping in the debugger. What I'd love to do is drop a HWND into a Watch child window and see things such as:

  • Client Rect
  • Window Rect
  • Styles / Extended Styles
  • The window's class in human-readable form
  • The window's name (::SetWindowText)
  • etc.

This seems like pretty basic stuff to me that would be useful to anyone. Does such a plugin exist? Can I accomplish this by playing games with Autoexp.dat?

Beginner answered 12/3, 2012 at 22:56 Comment(5)
No, that requires running code. You could write such code and look at the values they return. But that's not particularly useful in a debugging session. Spy++ was made for this.Glanders
When you say, "you could write such code", do you mean add small utility functions that return the information, link them into my app, and invoke them in the debugger?Beginner
You can write an add-in to do this, but honestly Spy++ is the best way to go.Brendanbrenden
I am aware that Spy++ does this, and I am aware that people can write plugins. My specific question is: Is there a plugin does this already?Beginner
In the watch window you can add a type behind the variable of the hwnd: #218556Pothead
R
2

I don't know if you can do this in Visual Studio, but windbg has an extension (userexts) that can display quite a bit of info about HWNDs.

!userexts.dw -v hwnd

will dump all that you ask and more.

Apparently you can integrate Visual Studio and Windbg according to this blog article; you can attach to a process and use the immediate window to execute windbg extensions.

Retract answered 4/8, 2013 at 17:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.