Thursday, March 3, 2005

Fun with watches

As I was in a coworker's office today witnessing the most intense power-debugging session I've ever seen (especially since the program being debugged wasn't even running; he just had a memory dump), I noticed a cool thing about the Watches window in Visual Studio that I figured I'd share.

Anyone who's tried to do something in Windows that their framework (MFC, Windows Forms, VB classic) didn't support will probably find this useful. Sometimes you stumble across some integer that you know if a window message (such as WM_LBUTTONDOWN), but you don't know what number it resolves to. To find out, you can create a watch for that integer, and append the string ",wm" to the value. Visual C++ will then present the value of the watch as a Windows message instead of a plain integer. You can do a similar thing to find out the value of an HRESULT code by adding ",hr" to the end. I'm sure that there are other neat things like this that I didn't know about.

No comments: