A connectable object is one that supports outgoing interfaces. An outgoing interface allows the object to communicate with a client. For each outgoing interface, the connectable object exposes a connection point. Each outgoing interface is implemented by a client on an object called a sink.
Each connection point supports the IConnectionPoint interface. The connectable object exposes its connection points to the client through the IConnectionPointContainer interface.
This article:
See Also The Proxy Generator, IConnectionPoint and IConnectionPointContainer in the Win32 SDK
ATL uses the following template classes to support connection points:
To add a connection point to an object:
BEGIN_CONNECTION_POINT_MAP(x) CONNECTION_POINT_ENTRY(iid) END_CONNECTION_POINT_MAP()
The parameter x is the name of your class, while iid is the IID of the interface represented by the connection point.
This example shows an object that supports the IPropertyNotifySink connection point:
class CConnect : public CComObjectRootEx<CComObjectThreadModel>, public CComCoClass<CConnect, &CLSID_CConnect>, public IConnectionPointContainerImpl<CConnect> public IConnectionPointImpl<CConnect, &IID_IPropertyNotifySink> { public: ... BEGIN_COM_MAP(CConnect) COM_INTERFACE_ENTRY(IConnectionPointContainer) END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CConnect) CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink) END_CONNECTION_POINT_MAP()
... };
Note When specifying IPropertyNotifySink as an outgoing interface, you can use class IPropertyNotifySinkCP instead of IConnectionPointImpl. For example:
class CConnect : public CComObjectRootEx<CComObjectThreadModel>, public CComCoClass<CConnect, &CLSID_CConnect>, public IConnectionPointContainerImpl<CConnect>, public IPropertyNotifySinkCP<CConnect> { ... };