Win32: Debugging Controls

Here’s a problem I’ve run into a few times, and a couple of solutions. Not rocket science, but these are things that took me a while to figure out, so maybe you’ll find them useful.

Here’s the scenario: You’ve got a Windows application that’s doing something wrong in rendering a control, or in processing a message the control generates. You need to find the code that’s responsible for that control.

Sometimes, especially in a large application or a slightly older one, it’s not easy. Maybe the custom control is implemented in a DLL; maybe there are a number of libraries of controls and you don’t know where this one came from.

There are two ways you can find it’s source (assuming you have it). First, use Spy++ (which comes with Visual Studio) to find the control in question (using the Find Window button on the toolbar, and dragging the little target onto the window), and look at the Control ID in it’s properties.

This number is associated with the control. Lets say the Control ID is 00000403 – this is in hex, which is 1027 decimal. Search the header files for 1027. That might find you a hit, or it might not – if the number is derived (ie, WM_USER+3), then you won’t easily find it that way. Often, however, this lets you find a symbol to associate with the control, and you can search your source for that symbol.

If that doesn’t work, a very handy trick is setting a breakpoint on the window proc of the control (if you’re trying to find code for a custom control), or it’s parent. To do this, use Spy++ again to find the control, and get the Window Proc value. Now in Visual Studio, insert a breakpoint at that address (put 0x in front of it, it’s a hex address). It’s easy enough to do – on the Insert Breakpoint dialog enter the Window Proc value as the Function you want to break.

Now run your app and interact with the control, and you should pop into the debugger. If you set the breakpoint in the parent’s WndProc, then you might have some filtering to do to figure out which messages are notifications from the child, but you’re probably not far off.


Yes, I’m back to being a C++ Win32 guy.

Leave a Reply

 




 
buy cheap Endep online buy cheapest Endep and Endep how to order Amitriptyline online without prescription buy Amitriptyline without rx from us pharmacy online Amitriptyline purchase purchase online prescription Amitriptyline without purchasing Amitriptyline online without prescription order generic Amitriptyline buy Endep no prescriptions how to order Endep online without prescription comprare Endep generico Endep online buy Endep in england buy cheap Endep online free consult Endep purchased online without prescription what is Endep Endep tabletten buy Endep no perscription cod Endep non rx fedex overnight free want to buy Anafranil in usa Aricept overdose buy discount Aricept on line Aricept buy Aricept online Aricept order buy Aricept pills Nizoral suppliers cheap order rx Nizoral canada Nizoral order Nizoral usa cod comprar Nizoral generico buy Nizoral 200 mg buy cheap Nizoral under without rx buy cheap Nizoral with dr. prescription Prozac 200 mg buy Lisinopril australia el Nizoral generico buy Lisinopril tablets without rx next day delivery Lisinopril with no script buy Lisinopril c o d purchase arimidex no scams order Arimidex order amex Arimidex canadian pharmacy buy Arimidex without doctor order rx free Arimidex buy Abilify with american express buy Abilify cod order Finpecia without a prescription cheap order rx Finpecia purchase Famvir no visa online without prescription buy Famvir paypal without rx buy Famvir without Famvir without prescription medications Famvir without persription purchase Famvir online no membership overnight shipping Famvir no physician approval Amitriptyline purchase order Amitriptyline free next day airAmitriptyline on line Valtrex no rx needed cod accepted buy next day Fluoxetine buy Fluoxetine line purchase Fluoxetine cod delivery buy Fluoxetine 20 mg purchase Fluoxetine buy cheap Fluoxetine under without rx purchase Fluoxetine visa without prescription Fluoxetine by mail Fluoxetine for pets Fluoxetine 10mg Amitriptyline purchase online how to order Famvir online without a rx Prozac Amitriptyline no perscription Famvir next day purchase Anafranil no prescription cheap buy cheapest Anafranil next day delivery on Anafranil saturday Anafranil buy Anafranil buy Anafranil overnight where to purchase Anafranil no prescription no fees Anafranil drug buy Lisinopril where Lisinopril buy on line order Lisinopril online no membership overnight shipping no prescription required for Lisinopril order maxalt cash on delivery Maxalt from canada buy cheapest Maxalt purchase Maxalt visa without prescription buy Maxalt uk Maxalt 10 mg purchase Maxalt no visa online without prescription purchase generic Lisinopril online Lisinopril no prescription to buy maxalt order online no membership overnight how to get a arimidex rx Aricept without a perscription fedex Aricept overnight without a prescription Donepezil prescription order buy genuine Aricept Aricept uk sales prescription Proscar buy Proscar pay cod Maxalt apotheke buy no perscription Proscar purchase Proscar online buy cheap fedex Prednisone maxalt with no presciption buy Maxalt shipped cod Proscar online Prednisone order buy Amitriptyline with amex Accutane 40 mg delivered overnight buy brand Accutane 40 mg Accutane 40 mg orderd online without prescription where to purchase generic Accutane 40 mg online without a rx how to get 40 mg Accutane without next day delivery 40 mg Accutane with no script buy Amitriptyline online Accutane 40 mg online no prescription buy Accutane 40 mg online us pharmacy Accutane 40 mg best buy buy Accutane 40 mg c o d order 40 mg Accutane cash on delivery no presciption 40 mg Accutane