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?

typ1232
  • 5,535
  • 6
  • 35
  • 51
Armentage
  • 12,065
  • 8
  • 33
  • 33
  • 1
    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. – Hans Passant Mar 13 '12 at 00:11
  • 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? – Armentage Mar 13 '12 at 01:03
  • You can [write an add-in](http://msdn.microsoft.com/en-us/library/aa730838%28v=vs.80%29.aspx) to do this, but honestly Spy++ is the best way to go. – Luke Mar 13 '12 at 03:30
  • 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? – Armentage Mar 13 '12 at 22:08
  • In the watch window you can add a type behind the variable of the hwnd: http://stackoverflow.com/questions/218056/visual-studio-debugger-tips-tricks-for-c-c-projects – Jochen Kalmbach Jul 22 '13 at 18:24

1 Answers1

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.

Eric Brown
  • 13,774
  • 7
  • 30
  • 71