Summary

While the IUnknown::QueryInterface function handles access to an object's incoming interfaces, some objects need to send notifications, events, or requests back to their clients. An object of that kind is a connectable object. The interfaces that a connectable object calls are outgoing interfaces. The connectable object defines and calls interfaces itself, but its client implements these interfaces through sink objects. Through outgoing interfaces, an object carries out two-way communication with its client. One object can multicast to multiple sinks, and one sink can easily accept calls from multiple objects.

To express its outgoing interfaces, an object implements the interface IConnectionPointContainer, through which the client can access the object's connection points, which are small contained objects within the connectable object itself. Through IConnectionPointContainer, the client can enumerate the available connection points or ask for a specific one given the outgoing interface's IID. Each connection point then manages connections to one or more sinks through the interface IConnectionPoint. This two-level container or connection-point architecture will allow for extension of the connection-point idea through additional interfaces, if they become necessary.

This chapter has examined these interfaces, in regard to both the client and the object, through sample code.