Game Development Reference
In-Depth Information
Figure 9.1
The Find window with Spy++.
up Microsoft Spy++ on a Windows desktop and see for yourself. Microsoft Spy++ is
a tool that you use to figure out which Windows messages are going to which win-
dow, and it
'
s a great debugging tool if you are coding a standard GDI-based applica-
tion. Here
'
s a quick tutorial:
1. If you are running Visual Studio, select Spy++ from the Tools menu. You can
also launch it from the Tools section of the Visual Studio area of your Start menu.
2. Close the open default window and select Find Window from the main menu or
press Ctrl-F.
3. You
ll then see a little dialog box that looks like the one shown in Figure 9.1.
4. Click and drag the little finder tool to the window or button you are interested
in and then click the Messages radio button at the bottom of the dialog. You
'
'
ll
get a new window in Spy++ that shows you every message sent to the object.
Perform the previous experiment again, but this time use Spy++ to monitor the Win-
dows messages sent to the button. You
ll find that as soon as you click on the button,
every mouse action will be displayed, even if the pointer is far away from the button
in question. That might be interesting, but why is it important? If a user interface
uses the boundaries of an object like a button to determine whether it should receive
mouse events, capturing the mouse is critical. Imagine a scenario where you can
'
'
t
capture mouse events:
1. The mouse button goes down over an active button.
2. The button receives the event and draws itself in the down position.
Search WWH ::




Custom Search