Visual C++ 6 Unleashed

Visual C++ 6 Unleashed

By Mickey Williams and David Bennett

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.

01fig19.gif

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:

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:

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:

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++.

Share ThisShare This

Informit Network