IConnectionPoint::Advise method (ocidl.h)
Establishes a connection between a connection point object and the client's sink.
HRESULT Advise( [in] IUnknown *pUnkSink, [out] DWORD *pdwCookie );
A pointer to the IUnknown interface on the client's advise sink. The client's sink receives outgoing calls from the connection point.
A pointer to a returned token that uniquely identifies this connection. The caller uses this token later to delete the connection by passing it to the IConnectionPoint::Unadvise method. If the connection was not successfully established, this value is zero.
This method can return the standard return values E_OUTOFMEMORY and E_UNEXPECTED, as well as the following values.
||The connection has been established and *pdwCookie has the connection token.|
||The value in pUnkSink or pdwCookie is not valid. For example, either pointer may be NULL.|
||The connection point has already reached its limit of connections and cannot accept any more.|
||The sink does not support the interface required by this connection point.|
Advise establishes a connection between the connection point and the caller's sink identified with pUnkSink.
The connection point must call QueryInterface to obtain the correct outgoing interface pointer to call when events occur, with the IID for the outgoing interface managed by the connection point. When the IID is passed to the IConnectionPointContainer::FindConnectionPoint method, an interface pointer to this same connection point is returned.
The pdwCookie value must be unique for each connection to any given instance of a connection point.
|Minimum supported client||Windows 2000 Professional [desktop apps | UWP apps]|
|Minimum supported server||Windows 2000 Server [desktop apps | UWP apps]|