Managing Events in Your Automation Object

From RAD Studio
Jump to: navigation, search

Go Up to Defining a COM Object's Interface


The Automation wizard automatically generates event code if you check the option Generate Support Code, in the Automation Object or ASP Object Wizard dialog box.

For a server to support traditional COM events, it must provide the definition of an outgoing interface which is implemented by a client. This outgoing interface includes all the event handlers the client must implement to respond to server events.

When a client has implemented the outgoing event interface, it registers its interest in receiving event notifications by querying the server's IConnectionPointContainer interface. The IConnectionPointContainer interface returns the server's IConnectionPoint interface, which the client then uses to pass the server a pointer to its implementation of the event handlers (known as a sink).

The server maintains a list of all client sinks and calls methods on them when an event occurs.

When you select Generate Event Support Code, Delphi automatically generates the code necessary to support IConnectionPoint and IConnectionPointContainer. This support, and the way you can use it to generate events, is described in Exposing events to clients.

See Also