We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.


Use the ON_EVENT macro to define an event handler function for an event fired by an OLE control.

ON_EVENT(theClass, id, dispid, pfnHandler, vtsParams )


The class to which this event sink map belongs.


The control ID of the OLE control.


The dispatch ID of the event fired by the control.


Pointer to a member function that handles the event. This function should have a BOOL return type, and parameter types that match the event's parameters (see vtsParams). The function should return TRUE to indicate the event was handled; otherwise FALSE.


A sequence of VTS_ constants that specifies the types of the parameters for the event. These are the same constants that are used in dispatch map entries such as DISP_FUNCTION.

The vtsParams argument is a space-separated list of values from the VTS_ constants. One or more of these values separated by spaces (not commas) specifies the function's parameter list. For example:


specifies a list containing a short integer followed by a BOOL.

For a list of the VTS_ constants, see EVENT_CUSTOM.

Header: afxdisp.h