Share via


AppWizard, ClassWizard, and the Resource Editors

OverviewHow Do ITutorial

Visual C++ includes several wizards and the WizardBar for use in MFC programming, along with many integrated resource editors. For ActiveX controls programming, the ActiveX ControlWizard serves a purpose much like that of AppWizard. While you can write MFC applications without most of these tools, the tools greatly simplify and speed your work.

Use AppWizard to Create an MFC Application

Use AppWizard to create an MFC project in Visual C++ — which can include OLE and database support. Files in the project contain your application, document, view, and frame-window classes; standard resources, including menus and an optional toolbar; other required Windows files; and optional .RTF files containing standard Windows Help topics that you can revise and add to in order to create your program's help file.

Use ClassWizard to Manage Classes and Windows Messages

ClassWizard helps you create handler functions for Windows messages and commands, create and manage classes, create class member variables, create Automation methods and properties, create database classes, and more.

Tip   ClassWizard also helps you to override virtual functions in the MFC classes. Select the class and the virtual function to override. The rest of the process is similar to message handling, as described in the following paragraphs.

Applications running under Windows are message driven. User actions and other events that occur in the running program cause Windows to send messages to the windows in the program. For example, if the user clicks the mouse in a window, Windows sends a WM_LBUTTONDOWN message when the left mouse button is pressed and a WM_LBUTTONUP message when the button is released. Windows also sends WM_COMMAND messages when the user selects commands from the menu bar.

In the MFC framework, various objects — documents, views, frame windows, document templates, the application object — can "handle" messages. Such an object provides a "handler function" as one of its member functions, and the framework maps the incoming message to its handler.

A large part of your programming task is choosing which messages to map to which objects and then implementing that mapping. To do so, you use ClassWizard.

ClassWizard will create empty message-handler member functions, and you use the source code editor to implement the body of the handler.

Quick access to frequently used features of ClassWizard are available at any time in the WizardBar, and you can create or edit classes (including classes of your own, not derived from MFC classes) and their members with ClassView.

Use the Resource Editors to Create and Edit Resources

Use the Visual C++ resource editors to create and edit menus, dialog boxes, custom controls, accelerator keys, bitmaps, icons, cursors, strings, and version resources. ClassWizard works with the editors: for example, when you create a dialog-template resource, you can run ClassWizard to connect the resource to a dialog class. As of Visual C++ version 4.0, a toolbar editor makes creating toolbars much easier.

To help you even more, the Microsoft Foundation Class Library provides a file called COMMON.RES, which contains "clip art" resources that you can copy from COMMON.RES and paste into your own resource file. COMMON.RES includes toolbar buttons, common cursors, icons, and more. You can use, modify, and redistribute these resources in your application. For more information about COMMON.RES, see the article COMMON.RES Sample Resources.

As you can see, AppWizard, the Visual C++ resource editors, ClassWizard, WizardBar, ClassView, and the MFC framework do a lot of work for you and make managing your code much easier. The bulk of your application-specific code is in your document and view classes. For a list of tutorials you can try, see MFC Tutorials Available.