The Internet Encyclopedia (Volume 3)

(coco) #1

P1: 50


Mayfield WL040/Bidgoli-Vol III-Ch-52 June 23, 2003 16:35 Char Count= 0


Visual C++ (Microsoft)Visual C++ (Microsoft)


Blayne E. Mayfield,Oklahoma State University

Introduction 635
The Visual C++ Integrated Development
Environment 635
Workspaces, Project Files, and the General
IDE Layout 635
Debugging Tools 636
The AppWizard and the ClassWizard 637
The Microsoft Foundation Class Library 637
MFC Overview 637
The Document/View Architecture 637
Single-Document and Multiple-Document
Interfaces 638
WinSock Programming 638
A Little History 638
WinSock Without MFC 638
WinSock-Related MFC Classes 639

Multithreaded Programming Issues 639
An Example WinSock Server 639
An Example WinSock Client 642
WinInet Client Programming 643
An Alternative to WinSock? 643
A WinInet Example 644
OLE, ActiveX, and COM 644
OLE 644
ActiveX 644
COM 644
ActiveX and Web Programming 644
Visual C++.NET: A Comparison 645
Conclusion 645
Glossary 645
Cross References 646
References 646

INTRODUCTION
From somewhat humble beginnings, Microsoft Visual
C++ has evolved into a powerful suite of tools for the
development of Windows applications. Software develop-
ment in Visual C++ centers on the IDE (Integrated Devel-
opment Environment), which provides the programmer
with tools including source and resource editors, debug-
gers, browsers, profilers, and the MFC (Microsoft Founda-
tion Class) library. As its name implies, MFC is a library of
C++ classes that supports a broad spectrum of program-
ming tasks for the Microsoft Windows operating systems.
In addition to describing briefly the major components of
the IDE, this chapter focuses on using these tools to de-
velop applications for the Internet. Although this is a big
enough topic to merit its own book, the chapter provides
a foundation for further reading, understanding, and ex-
perimentation.
This chapter assumes that the reader has a general un-
derstanding of Internet applications, such as the client–
server model; Comer and Stevens (1997) is a good source
of information on these topics. It also assumes that
the reader has a good working knowledge of object-
oriented techniques (classes, objects, message passing,
and inheritance) as defined and used in standard C++
applications in DOS, UNIX, or other operating sys-
tems.
The discussion and examples given below are based
on Visual C++, version 6.0. As this chapter is being writ-
ten a new version——Visual C++.NET——has just arrived
on the development landscape. However, it is anticipated
that the examples provided here should work using either
version, and they should run under Windows 98, ME, NT,
2K, and XP.

THE VISUAL C++ INTEGRATED
DEVELOPMENT ENVIRONMENT
Workspaces, Project Files, and the
General IDE Layout
Applications in Visual C++ are maintained as a hierarchy
of files. The top level of this hierarchy is theworkspace;
a workspace is a collection of one or more projects. A
projectis a collection of user-defined files, along with
system-defined files that maintain information about the
project. Like makefile in UNIX, a Visual C++ project is
intended to ease the care and feeding of applications con-
sisting of numerous source and header files. Also like
makefile, projects keep track of file changes so that only
the source and header files that have been modified are
recompiled at build time. Further, as one moves from con-
sole applications into the more complex world of Win-
dows applications, the project also help keeps track of
details and changes related to the GUI (graphical user in-
terface) aspects of the application. Generally, a workspace
contains only one project, though it can contain multiple
projects.
Figure 1 illustrates a typical project and various as-
pects of the IDE as they appear in Windows XP. Area 1
is thetoolbararea; as with most Microsoft products, this
area can be customized to meet the user’s needs. Below
the toolbars and on the right (area 2) is thesource editor.
Like many modern source editors, it is color-coded; i.e.,
keywords appear in one color, comments in another color,
etc. The programmer can customize the colors and font
faces used in the source editor.
Area 3 of the IDE is especially significant in its utility
to the developer. This area presents different views of the

635
Free download pdf