Connections

Normally the client calls functions in an interface of the object. A connectable object (or source) also has the capability to call functions in interfaces (of a sink object) provided by the client, for the purpose of:

Events (or notifications): informing the client that some event has occurred.

Requests: querying the client to obtain to some information.

To establish a connection:

The client obtains the object’s IConnectionPointContainer interface (by calling QueryInterface with an IID of IID_IConnectionPointContainer).

The client calls the IConnectionPointContainer interface’s FindConnectionPoint function, passing the IID of the sink interface to be used. If the object recognises this interface, it returns an IConnectionPoint interface.

The client calls the IConnectionPoint interface’s Advise function, passing the IUnknown interface of the sink. The connection point calls the sink’s IUnknown interface to obtain the correct interface. A token value (or cookie) is returned to the client.

The object can now call the functions in the interface provided by the sink.

When the client calls the IConnectionPoint interface’s Unadvise function, passing the token value, the connection is broken.