Spy++ to Understand Windows Controls in a Visual C++ Dialog based Application

Graphical User Interface Applications created using Visual C++ are designed using a Resource Editor and a ToolBox. Everything in the Toolbox of Visual C++ basically represent a Window. Each Window is identified by number of attributes like Class, Window Style, Window Handle, etc. This post helps you understand the Graphical User Interface Architecture of Visual C++ Applications using the Spy++ Tool provided with Visual Studio.

Adding Controls to MFC Dialog Based Application Created with Visual C++

Adding Controls to MFC Dialog Based Application Created with Visual C++

Again this Example Does not requires any C++ Coding and is easy to understand with the Screenshots provided. The Visual C++ Application created in the Dialog Based MFC Example has been modified as displayed in the screenshot above to include some controls like Button, Check Box, Radio Button, etc. Once you have modified your Dialog based Application as displayed in this example. build the application and run it.

Spy++ to View Properties of Dialog based MFC Application created with Visual C++

Spy++ to View Properties of Dialog based MFC Application created with Visual C++

Once you do have your Dialog based Application with Controls added as displayed above, launch the Spy++ Application. From the Spy Menu, launch the Find Window and drag the Finder Tool from the Find Window of Spy++ to any control on the Dialog based MFC Application. As you drag the Finder Tool around, the Find Window will automatically display various properties of the Window beneath the Finder Tool.

This Spy++ Tool is a really useful tool and helps you to find out Class Name, Size /  Location of the Control, Window Styles assigned to any Window Control and even displays Window Messages received by the control. In case you are attending any Visual C++ Course, you must ask your instructor about this Spy++ Tool which gives you insight into the Graphical User Interface of the Applications created using Visual C++. Yes Graphical User Interface created in other programming languages are also Window Controls, however many programming languages creates their own controls by sub classing basic Window Controls.