Export (0) Print
Expand All

How to: Expose ActiveX Objects

To expose ActiveX objects, you write code to initialize the objects, implement the objects, and then release OLE when the application terminates.

ms221326.wedge(en-us,VS.85).gifTo initialize exposed objects

  1. Initialize OLE.

  2. Register the class factories of the exposed objects.

  3. Register the active object.

ms221326.wedge(en-us,VS.85).gifTo implement exposed objects

  1. Implement the IUnknown, IDispatch, and virtual function table (VTBL) interfaces for the objects.

  2. Implement the properties and methods of the objects.

ms221326.wedge(en-us,VS.85).gifTo release OLE when the application terminates

  1. Revoke the registration of the class factories and revoke the active object.

  2. Uninitialize OLE.

ms221326.wedge(en-us,VS.85).gifTo retrieve active objects for use by others

  1. Use the Object Description Language (ODL) to create an .odl file, or use the Interface Definition Language (IDL) to create a library section in an .idl file that describes the properties and methods of the exposed objects. Use the Microsoft Interface Definition Language (MIDL) compiler to compile both the .idl file and .odl file.

  2. Create a registration (.reg) file for the application.

In this section

TopicDescription

Initializing Exposed Objects

To initialize OLE and exposed objects, use OleInitialize, CoRegisterClassObject, and RegisterActiveObject.

Implementing Exposed Objects

To expose ActiveX objects, you must implement certain interfaces.

Implementing a Class Factory

This topics describes what you must do to expose objects for Automation.

Exposing the Application Object

The Application object identifies the application and provides a way for ActiveX clients to bind to and navigate the application's exposed objects. All other exposed objects are subordinate to the Application object; it is the root-level object in the object hierarchy.

Creating a Registration File

Before an application can use OLE and Automation, the OLE objects must be registered with the user's system registration database.

Releasing OLE and Objects

To release OLE and the exposed objects, use the RevokeActiveObject, CoRevokeClassObject, and OLEUninitialize functions.

Retrieving Objects

Automation provides several functions to identify and retrieve the active instance of an object or application, so you can make the object available to others.

Returning Objects

To return an object from a property or method, the application should return a pointer to the object's implementation of the IDispatch interface.

Shutting Down Objects

Describes how to shut down an ActiveX object.

 

 

 

Community Additions

ADD
Show:
© 2014 Microsoft