Visual C++ 6 Unleashed

Visual C++ 6 Unleashed

By MICKEY WILLIAMS and David Bennett

ClassWizard

In developing C++ applications, you will do a lot of work with your own classes. Develo per Studio provides you with the ClassWizard to help in organizing your classes and integrating your classes with Windows. ClassWizard may be started from the View menu or by pressing Ctrl+W. The ClassWizard dialog box is made up of several different tabs, or pages, each of which allows you to work with different aspects of your classes. We will look at each of these tabs in the following sections.

Message Maps

The Message Maps page allows you to work with assigning message handlers to Win dows messages that your application will receive. This is really the heart of programming in the Windows event-driven programming model. The Message Maps tab is shown in Figure 1.20.

01fig20.gif

Figure 1.20 Class Wizard—Message Maps.

We will look at the specifics of using Class Wizard to work with message maps in Chapter 3, "MFC Message Handling Mechanism."

Member Variables

The Member Variables page, shown in Figure 1.21, is used to create member variables of your class that will be used to work with controls in dialog boxes. Unfortunately, it does not allow you to work with more general sorts of member variables.

01fig21.gif

Figure 1.21 Class Wizard—Member Variables.

Automation

The Automation tab, shown in Figure 1.22, helps you work with the methods and properties associated with classes that use Automation.

01fig22.gif

Figure 1.22 Class Wizard—Automation.

ActiveX Events

The ActiveX Events tab, shown in Figure 1.23, allows you to easily manage the ActiveX events that are supported by your ActiveX classes.

01fig23.gif

Figure 1.23 Class Wizard—ActiveX Events.

Class Info

The Class Info tab, shown in Figure 1.24, will show you some general information about your classes, including the header and source files that it is defined in, as well as its base class and any resource associated with it.

01fig24.gif

Figure 1.24 Class Wizard—Class Info.

Adding a Class

The Add Class button provides a quick and easy way to create a new class in your project. The New Class dialog box, which is presented when you choose New, allows you to choose the name for your new class and the base class that it derives from. You may select the file to create the class in and specify a particular resource that should be associated with the class. If the base class you choose can support Automation, you may specify options. The new class can also be automatically added to the Component Gallery.

In addition, you may choose the From a Type Library option when adding a new class. This will allow you to create classes based on an existing COM type library.

Share ThisShare This

Informit Network