Adding Objects and Controls

You can use the ATL Object Wizard to add an object or a control to your ATL or MFC-based projects. For each COM object or control you add, the wizard generates CPP and H files, as well as an RGS file for script-based registry support.

If you are attempting to add a simple COM object to an MFC project, you will need to add ATL support to the existing project. For more information on this feature, see Adding ATL Support to Your MFC Project.

Note   The ATL Object Wizard adds the object to the active project. If you wish to add the control to another project on the workspace, you must first make it the active project.

To add an object or a control using the ATL Object Wizard

Note   If this is an MFC project to which you have not previously added an ATL object, you'll be prompted to specify whether you want ATL support added to your project. Clicking Yes opens the ATL Object Wizard.

The ATL Object Wizard displays the categories of objects on the left and the icons of the objects in each category on the right. Choose a category; the wizard displays the icons of the objects in that category.

ATL Objects

ATL Controls

ATL Miscellaneous

Data Access

Double-click the control or object you want to insert. The ATL Object Wizard displays a dialog box showing options that apply to your object or control.

Note   Depending on the type of object or control you select, some of the pages and options described below may not be available.

In the Names page, enter class and file names. By default, the name you enter for Short name becomes the root for all other names in this page. You can enter your own names rather than accept these defaults.

In the Attributes page, select a threading model, interface type, and aggregation support:

In the Miscellaneous page, choose the features for the object.

In the Stock Properties page, select the stock properties you want the object to support, such as Caption or Border Color. You can select all the stock properties at once by clicking the >> button.

In the Strings page, enter names for the property page object.

In the Add-in page, choose features for the Add-in object.

In the ASP page, choose features for the Active Server component.

In the MTX page, choose features for the Microsoft Transaction Server component. Dual and Custom choose the kind of interface implemented, and Support Connection Points adds support for connection points. These options are the same as the ones in the Attributes page for other kinds of objects. In addition, the MTX page has two unique options: