AdviseConnect

HRESULT WINAPI AdviseConnect(
LPUNKNOWN pUnkNotifier,
 REFIID riid, 
LPUNKNOWN pUnkNotify, 
DWORD* pdwCookie, 
BOOL fAddRef = TRUE);

Parameters

pUnkNotifier

Object from which notifications are originating. This object must implement IConnectionPointContainer.

riid

GUID of the notification interface to be used for the connection.

pUnkNotify

Pointer to IUnknown of the object to receive notifications. This object must implement the notification interface identified by the riid parameter.

pdwCookie

Pointer to a DWORD buffer to store proprietary data about the connection. This cookie is passed to AdviseDisconnect when the caller is done with the connection.

fAddRef

 TRUE to keep a reference count on the pUnkNotify object during the notification.

Return Code

S_OK

Method succeeded.

E_NOINTERFACE

E_OUTOFMEMORY

Comments

Call to initiate an advise connection using the IConnectionPointContainer and IConnectionPoint interfaces.

Set fAddRef to FALSE to prevent the notifier object from keeping a reference count on pUnkNotify during a connection. If fAddRef is FALSE during a call to AdviseConnect, then it must be FALSE during the call to AdviseDisconnect to prevent reference-counting problems.