Using IProvideClassInfo

A connectable object can offer the IProvideClassInfo[x] interfaces so its clients can easily examine its type information. See Providing Class Information chapter for more 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 it can dynamically provide a sink supporting the right entry points.

First, as described above, the client can enumerate the connection points and can then call IConnectionPoint::GetConnectionInterface for each connection point to obtain the IIDs of outgoing interfaces supported by the connectable object.

Second, the client queries the connectable object for one of the IProvideClassInfo[x] interfaces. Third, the client calls methods in these interfaces to get the type information for the outgoing interface. Fourth, the client creates a sink object supporting the outgoing interface. Finally, the process continues as described above with the client calling 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.