Standard Event Handling

To use the standard ActiveX event-handling mechanism, a designer supports the IConnectionPoint and IConnectionPointContainer interfaces, along with interfaces for each type of event to be handled. The following figure shows the basic approach to event handling:

Through IConnectionPoint, the designer exposes an outgoing pointer to an object, typically an event sink. IConnectionPointContainer enumerates the connection points supported by an object, so a caller can find the right connection point. When an event occurs, the ActiveX designer uses a connection between the event source, which calls the interface that handles events of that type, and the event sink, which implements the interface. The sink implements the member functions for a set of events.

At design time, the host inspects the type information for the object's event set. From this information, the host enumerates the set of events an object can trigger. To allow users of an ActiveX designer to write event handlers, the host checks the parameters of the events, and from them creates a stub event handler for the user to fill in. At run time, the host connects the sources and sinks after loading the designer.

For property changes, ActiveX designers implement a standard sink interface called IPropertyNotifySink.

See the COM Programmer’s Reference in the COM and ActiveX Object Services section of the Platform Software Development Kit (SDK) for more information on the connection point and property sink interfaces.