Поделиться через


Creating the ActiveX Control Project

The first step is to create the project using the Visual C++ integrated development environment. By default, the ATL Project Wizard supplies attribute support, and creates a project that uses them for basic framework implementation.

Procedures

To generate a sample project with the ATL Project Wizard

  1. On the File menu, click New, and then click Project.

    The New Project dialog box appears.

  2. In the Project Types pane, click Visual C++ Projects, and in the Templates pane, click the ATL Project icon.

  3. In the Name box, enter MyAxCtrl and click OK.

    The ATL Project Wizard appears.

  4. Click Application Settings.

    You will see that the Attributed check box and Dynamic-link library (DLL) radio button are selected by default.

  5. Click Finish to close the ATL Project Wizard and generate your project.

A Visual C++ DLL project hosting the ActiveX control is generated. For more information on this wizard, see ATL Project Wizard.

Attributes Used in the MyAxCtrl Project

Before inserting the ATL control component, note that the atlplus.h file is added by the ATL Project Wizard (included in atlbase.h, which is in turn included by stdafx.h). When the implementation for an attribute is needed from an ATL provider, this file provides the information needed by the compiler.

ПримечаниеПримечание.

Another class of attributes have an implementation provided by the compiler and do not require any specialized header file. For more information, see COM Attributes and IDL Attributes.

The module Attribute

At this stage of development, the module attribute (located in MyAxCtrl.cpp) is the workhorse of the project. This attribute provides information on various characteristics of the target module.

In this example, the module attribute specifies the module type as a DLL, a unique ID for the module (making use of the uuid attribute), and a simple name for the module.

To move to the next step, see Inserting the ATL Control Component.

См. также

Основные понятия

Walkthrough: Creating an ActiveX Control with Attributes

Adding a Property Using Attributes

Adding an Event Using Attributes

Attributes Walkthroughs