Muokkaa

Jaa


Adding Objects and Controls to an ATL Project

Note

The ATL COM+ 1.0 Component Wizard, ATL OLE DB Consumer wizard, and ATL Active Server Page Component wizard are not available in Visual Studio 2019 and later.

You can use one of the ATL code wizards 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. The following ATL code wizards are available in Visual Studio:

Note

Before adding an ATL object to your project, you should review the details and requirements for the object in its related Help topics.

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

  1. In Solution Explorer, right-click the project node and click Add from the shortcut menu. Click Add Class.

    The Add Class dialog box appears.

  2. With the ATL folder selected in the Categories pane, select an object to insert from the Templates pane. Click Open. The code wizard for the selected object appears.

    Note

    If you want to add an ATL object to an MFC project, you must add ATL support to the existing project. You can do this by following the instructions in Adding ATL Support to Your MFC Project.

    Alternately, if you attempt to add an ATL object to your MFC project without previously adding ATL support, Visual Studio prompts you to specify whether you want ATL support added to your project. Click Yes to add ATL support to the project and open the selected ATL wizard.

See also

ATL Project Wizard
C++ project types in Visual Studio
Fundamentals of ATL COM Objects
Programming with ATL and C Run-Time Code
Default ATL Project Configurations