P1: 50
Mayfield WL040/Bidgoli-Vol III-Ch-52 June 23, 2003 16:35 Char Count= 0
636 VISUALC++ (MICROSOFT)Figure 1: Commonly seen aspects of the Visual C++ IDE.project, and one chooses the view from among the view
tabs at the bottom of this area. The information in all
views is presented in a tree format, similar to that used
by the Windows Explorer. The three most common views
are as follows:Thefile view:The project is presented as a categorized list
of all files. Double-clicking on a file name opens the file
in the source editor.
Theclass view:The class and global definitions found in
the application are presented. (This is the view shown
in Figure 1.) Double-clicking on a class name opens
in the source editor the file containing the class inter-
face. Double-clicking on a class method name opens
in the source editor the file containing the method im-
plementation and places the cursor at the beginning of
that implementation.
Theresource view:This view presents the GUI and other
Windows-specific resources associated with the ap-
plication. Resources include such things as bitmaps,
dialog boxes, and menus. Double-clicking on a re-
source opens it using the appropriate editor in the
area normally occupied by the source editor. For
example, Figure 2 illustrates a dialog resource open
in thedialog resource editor. Note the toolbar at the
left containing drag-and-drop icons for a host of dialog
controls, such as edit boxes, buttons, combo boxes, and
calendars.Theoutput windows(area 4 in Figure 1) have a multi-
tude of uses. When one builds (i.e., compiles and links)
a project, error and warning messages appear in this
area. When one double-clicks on any of these messages,
the file containing the offending statement is opened
in the source editor, and the cursor is placed at the
statement.Debugging Tools
A Visual C++ “.exe” project commonly is built in one of
two configurations: release and debug. A debug build pro-
duces a larger executable file that runs more slowly, but
the executable contains information that can be used with
the interactive debugging facilities of the IDE. A release
build is smaller and faster, but does not support use of the
interactive debugger.
The Visual C++ interactive debugger is a great asset
to the development of complex programs. It permits one
to set breakpoints on source code statements such that
execution stops just before the marked statements are to
be executed. (Figure 1 illustrates a breakpoint, which ap-
pears as a large red dot in the left margin of the marked
statement.) When a breakpoint is encountered, execution
of the program stops and control is turned over to the pro-
grammer. The programmer then can examine and change
variable values, single step through the code, execute to a
given point in the code, and continue execution without
further breaks.
In a similar fashion, if a run-time error occurs, the de-
bugger gives the programmer the option of going to that
point in the program, examining and changing variables,
seeing a function call trace, and continuing program exe-
cution.
One weakness of the Visual C++ debugger is the dif-
ficulty of using it to debug multithreaded programs. Re-
grettably, this includes many Internet applications.
Although Visual C++ is a great platform for develop-
ing many types of applications, its greatest strength is
in the development of Windows GUI applications. Cre-
ating and maintaining GUI applications under Windows
can be grueling. Fortunately, Visual C++ provides three
tools that make this task less tedious: theAppWizardand
ClassWizardand theMFC(discussed at length in the next
section).