- Table of Contents
- Copyright
- About the Authors
- About the Contributors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- How to Use This Book
- What You Need to Use This Book
- What's New in Visual C++ 6.0
- Contacting the Main Author
- Part I: Introduction
- Chapter 1. The Visual C++ 6.0 Environment
- Part II: MFC Programming
- Chapter 2. MFC Class Library Overview
- Chapter 3. MFC Message Handling Mechanism
- Chapter 4. The Document View Architecture
- Chapter 5. Creating and Using Dialog Boxes
- Chapter 6. Working with Device Contexts and GDI Objects
- Chapter 7. Creating and Using Property Sheets
- Chapter 8. Working with the File System
- Chapter 9. Using Serialization with File and Archive Objects
- Part III: Internet Programming with MFC
- Chapter 10. MFC and the Internet Server API (ISAPI)
- Chapter 11. The WinInet API
- Chapter 12. MFC HTML Support
- Part IV: Advanced Programming Topics
- Chapter 13. Using the Standard C++ Library
- Chapter 14. Error Detection and Exception Handling Techniques
- Chapter 15. Debugging and Profiling Strategies
- Chapter 16. Multithreading
- Chapter 17. Using Scripting and Other Tools to Automate the Visual C++ IDE
- Part V: Database Programming
- Chapter 18. Creating Custom AppWizards
- Chapter 19. Database Overview
- Chapter 20. ODBC Programming
- Chapter 21. MFC Database Classes
- Chapter 22. Using OLE DB
- Chapter 23. Programming with ADO
- Part VI: MFC Support for COM and ActiveX
- Chapter 24. Overview of COM and Active Technologies
- Chapter 25. Active Documents
- Chapter 26. Active Containers
- Chapter 27. Active Servers
- Chapter 28. ActiveX Controls
- Part VII: Using the Active Template Library
- Chapter 29. ATL Architecture
- Chapter 30. Creating COM Objects Using ATL
- Chapter 31. Creating ActiveX Controls Using ATL
- Chapter 32. Using ATL to Create MTS and COM+ Components
- Part VIII: Finishing Touches
- Chapter 33. Adding Windows Help
- Part IX: Appendix
MFC AppWizard
It has been rumored that in prehistoric days there was but one piece of code ever written and that all projects since were merely the result of cutting and pasting from other projects. This does seem to have the ring of truth every time I cut and paste the same boilerplate code for Windows applications for each new project. Visual C++ makes this task much simpler by providing the MFC Application Wizard, or AppWizard for short.
What MFC AppWizard Can Do for You
MFC AppWizard is really a collection of different Application Wizards that help to do different sorts of projects. (I will generally use AppWizard to refer to any of the Application Wizards and will be more specific when discussing one particular AppWizard.) Each of the AppWizards will guide you through the process of creating a new project, prompting for various option selections along the way.
When you have made all of your choices, MFC will create your project for you. For some types of projects, this can be a tremendous time-saver. For MFC applications, this means creating all of the source, header, resource, help, and project files necessary to create a skeleton for your application. The project created by the MFC AppWizard (exe) will build without any further modifications and has all of the setup for the application features you selected. This can easily reduce half a day's hunting, cutting, and pasting to just a few seconds.
Starting MFC AppWizard
To use MFC AppWizard to help you create a new project, Use the New command from the File menu. The Projects tab of this dialog box, shown in Figure 1.19, will show you a list of all of the available application wizards, including other simple new project types, such as Win32 Application.
Figure 1.19 The New Projects dialog box.
Project Types
The New Project Workspace gives you the opportunity to create several different types of projects, so let's take a brief look at what Visual C++ will do for you when you choose each project type.
ATL COM AppWizard
This is used to create a new project based on the Active Template Library (ATL). This type of project then allows you to add your own COM objects, using ATL.
Cluster Resource Type Wizard
This type of wizard is used to create a workspace that contains two projects that are used with Microsoft Cluster Server (MSCS), part of Windows NT Enterprise Edition.
One of the projects is used to create a resource DLL, which is used by MSCS to manage a resource—typically, a cluster-aware application.
The other project is a Cluster Administrator Extension DLL, which extends the MSCS Cluster Administrator, allowing a user to manage the interaction between MSCS and the resource.
Custom AppWizard
This type of project will allow you to create your very own AppWizard, which may then be used to help you create additional projects.
Database Project
This type of project allows you to test stored SQL procedures directly, without going through the process of creating an ODBC application. This project type is available only in Visual C++ Enterprise Edition.
DevStudio Add-In Wizard
This creates a new skeleton project that may be used to add commands to the Developer Studio environment. This project may include the framework required to add a toolbar to Developer Studio, as well as to handle events that occur within Developer Studio.
Extended Stored Procedure Wizard
This wizard allows you to create a SQL Server extended stored procedure. An extended stored procedure is hosted in a Win32 DLL. This project type is available only in Visual C++ Enterprise Edition.
ISAPI Extension Wizard
This wizard allows you to easily create the framework required to create extensions to Internet Information Server, using the Internet Server API.
Makefile
This project type is used to add a project that works with an external makefile. The project settings will allow you to specify the command line that you want to execute to build this project. By default, this is NMAKE /f myMake.mak. If you have existing makefiles that you want to incorporate into a build from Visual C++, without creating one of the other project types to replace your makefile, you should use this project type.
MFC ActiveX ControlWizard
This AppWizard will help you to create the framework for a project that uses the Microsoft Foundation Classes to implement ActiveX controls. We will be looking at how to implement ActiveX controls in more detail in Chapter 28.
MFC AppWizard (DLL)
This will use the MFC AppWizard for DLLs to create a new dynamic link library project for you. The project created implements the code needed to initialize a DLL that uses MFC, but you will need to add functionality to it.
MFC AppWizard (EXE)
This will start up the MFC AppWizard to help you create the framework for a full-blown MFC Windows application. We will look at this in more detail in Chapter 2, "MFC Class Library Overview," but feel free to try it out if you like. The skeleton application created by AppWizard is a complete application in that it will build and run. You just need to add on the functionality specific to your application.
Utility Project
This project type is a generic container for any types of files or custom build steps you would like to have performed. This type of project is useful as a master project for several subprojects in a workspace.
Win32 Application
The application project uses a very simple wizard that enables you to build three types of generic Win32 applications:
- A simple project with no source files included by default
- A typical generic Win32 project with one C++ source file
- A simple Win32 application that displays Hello World, consisting of resource files and a C++ source file
Each project has the default build settings for a Windows application. These types of projects are useful for creating a Visual C++ 6.0 project for existing applications that you are moving to VC++ 6.0. You will have to add your existing source files to the new project with the Project, Add to Project, Files dialog box.
Win32 Console Application
This project type will create a new project with the build settings appropriate for building console applications. A simple wizard is provided that enables you to build four types of generic console applications:
- An empty project containing no source files. You will need to add your own source files before building this project type.
- A simple project that contains one main source file. When launched, the program immediately exits.
- A simple Hello World project that contains one main source file. When launched, the program displays Hello World and exits.
- A simple project that will support MFC. This project contains a resource file in addition to the main source file.
This type of application does not have a Windows graphical interface, but uses a standard command window. This project type is appropriate for command-line utilities and other applications that do not have a graphical user interface.
Win32 Dynamic Link Library
This project type will create a Win32 DLL. A simple wizard allows you to choose from three types of Win32 DLLs:
- An empty project with no source files. You must add your own source files before building this type of project.
- A simple project with one main source file.
- A project that has one main source file and has examples of how to export symbols, such as classes and variables.
Each Win32 project type will set up the default project settings for creating a Win32 DLL.
Win32 Static Library
This is similar to the Dynamic Link Library option, but the project settings are set to create a standard statically linked library (.lib). A simple wizard allows you to specify if you would like to support pre-compiled headers or MFC in the project.
Other Project Types
You might also see additional project types listed. These are custom AppWizards that you have created, or that were provided by a third-party vendor and optionally loaded with Visual C++.
ClassWizard | Next Section

Account Sign In
View your cart