Using IProvideClassInfo
A connectable object can offer the IProvideClassInfo and IProvideClassInfo2 interfaces so that its clients can easily examine its type information. This capability is important when dealing with outgoing interfaces, which, by definition, are defined by an object but implemented by a client on its own sink object. In some cases, an outgoing interface is known at compile time to both the connectable object and the sink object; such is the case with IPropertyNotifySink.
In other cases, however, only the connectable object knows its outgoing interface definitions at compile time. In these cases, the client must obtain the type information for the outgoing interface so that it can dynamically provide a sink supporting the right entry points, as follows:
- The client enumerates the connection points and then, to obtain the IIDs of outgoing interfaces supported by the connectable object, calls IConnectionPoint::GetConnectionInterface for each connection point.
- The client queries the connectable object for one of the IProvideClassInfo interfaces.
- The client calls methods in the IProvideClassInfo interfaces to get the type information for the outgoing interface.
- The client creates a sink object supporting the outgoing interface.
- The process continues, and the client calls IConnectionPoint::Advise to connect its sink to the connection point.
In the type information, the attribute source marks an interface or dispinterface listed under a coclass as an outgoing interface. Those listed without this attribute are considered incoming interfaces.
Related topics