Adding an Event to an MFC ActiveX Control

OverviewHow Do I ... Topics

When you use the MFC ActiveX Control Wizard to create a control, Visual C++ creates two interfaces, displayed as icons in ClassView. The first is the dispinterface that you use to add properties and methods. The second is the dispinterface that you use to define outgoing events.

To add an event to an MFC ActiveX control

  1. Open the Add Event dialog box in one of the following ways:
  2. For stock events, select a name from the External name list. For new events you wish to define, type in the name in the External name text box.

    This is the name automation clients will use to request an event from the control. The Internal name box displays a suggested member function name. You can optionally change that name.

  3. For stock events, in the Implementation area, specify whether you will use the stock implementation or whether you will customize it.

    If you are defining a new event, this area is unavailable.

  4. For events you are defining, use the Parameter list to specify any parameters you want the event to take. For each parameter you wish to define:
  5. When you are finished defining the control event, click OK to exit the Add Event dialog box.

The event is visible as an icon in ClassView under the interface.

You can double-click the icon to jump to the definition in the .odl file. For custom events, or stock events with custom implementations, you can double-click the icon under the class that implements the interface (usually the control class) to jump to the .h file.