Copyright: OLE Automation Component Help


OLE Automation Component: Overview
OLE Automation Component - Overview

The OLE Automation component adds OLE Automation support and/or creatability to any class derived from the MFC class CCmdTarget. The level of support provided is essentially the same as the support you get when you use ClassWizard and select OLE Automation or creatability.

Note   This component will not make a non-OLE application into an OLE application. You will need to manually add code for initializing the OLE libraries and registering your OLE objects, if your application does not already contain code for doing so. For example, if your application is an OLE compound document server, it already contains the necessary initialization code. (See “Creating an OLE Server” in Tutorials if you need more information.)

OLE Automation Component - Results


OLE Automation Component: Results
OLE Automation Component - Results

The OLE Automation component makes the following changes to your project:

•	A dispatch map is added if one isn’t already there.

•	An interface map is added if one isn’t already there. If an interface map is added, an appropriate GUID is generated to go with the new interface map.

If you chose to make your class creatable by Automation clients, the following additional changes are made to your project:

•	Your class is made dynamically creatable if it isn’t already.

•	Your class is made OLE creatable if it isn’t already. If your class is made OLE creatable, an appropriate GUID is generated to go with the OLE creation interface.

•	Appropriate OLE interface calls are added to the class’s constructor(s) and destructor to work with OLE Automation.

This component can be used on any project that contains at least one class derived from CCmdTarget.


OLE Automation/Creation

This dialog box allows you to select the class you want to add OLE Automation to and the level of automation support.

Add OLE Automation to   Select the class you want to add OLE Automation support to. This drop-down list contains all of the CCmdTarget-derived classes in your project.

Automation   Select this option to expose your class to OLE Automation clients. This enables objects of your class to be accessed by Automation clients, such as Microsoft Visual Basic and Microsoft Excel.

Creatable by Type ID   Select this option to enable Automation clients to create objects of your class directly. Use the text box to specify the name that Automation clients use to request an object of your class. This option is available only for some classes.