E_NOINTERFACE ErrorThe E_NOINTERFACE error is returned when AtlAdvise() calls the QueryInterface() method for IID_IConnectionPointContainer and fails.
CONNECT_E_NOCONNECTION ErrorThe CONNECT_E_NOCONNECTION error is returned when AtlAdvise() calls the IConnectionPointContainer::FindConnectionPoint() method and fails. The ATL implementation of the IConnectionPointContainerImpl::FindConnectionPoint() function looks in the connection point map for the event interface and returns this error if it doesn't find it.
CONNECT_E_CANNOTCONNECT ErrorThe CONNECT_E_CANNOTCONNECT error is returned when AtlAdvise() calls the IConnectionPoint::Advise() method and fails. The ATL implementation of the IConnectionPointImpl::Advise() function calls QueryInterface() on the sink object (the client), looking for the event interface, and returns this error if it doesn't find it.
E_NOINTERFACE ErrorFor the E_NOINTERFACE error, verify that the source or server supports the IconnectionPointContainer interface. In ATL, this means that the source object should derive from the IConnectionPointContainerImpl class and that IConnectionPointContainer needs to be in the COM map, as in the following example:
class ATL_NO_VTABLE CMySource :
CONNECT_E_NOCONNECTION ErrorFor the CONNECT_E_NOCONNECTION error, verify that there is a connection point entry for the globally unique identifier (GUID) of the event interface in the connection point map, as in the following example:
CONNECT_E_CANNOTCONNECT ErrorFor the CONNECT_E_CANNOTCONNECT error, verify that the event interface is in the sink, or client, COM map, as in the following example:
If all the methods of the event interface pass automation-compatible types (they are VARIANT-compatible), you can set an attribute of "oleautomation" in the source .idl file. When an ATL server is registered, its type library is also registered. This sets up the marshaler for this interface to be the universal marshaler (in OleAut32.dll).
If the event interface passes non-automation-compatible types, then a proxy DLL needs to be built and registered. The ATL Project Wizard creates a proxy makefile in your project directory with the name <Project>.mk. You can run NMake.exe on this .mk file to build the proxy DLL.
AtlAdvise() wraps the following steps:
- Calls QueryInterface() to get an IConnectionPointContainer*.
- Calls IConnectionPointContainer::FindConnectionPoint() to get an IConnectionPoint*.
- Calls IConnectionPoint::Advise().
文章 ID：183216 - 上次审阅时间：2005年6月1日 - 修订版本： 1