Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Call this function to disconnect a connection between a source, specified by pUnkSrc, and a sink, specified by pUnkSink.

BOOL AFXAPI AfxConnectionUnadvise( 
   LPUNKNOWN pUnkSrc, 
   REFIID iid, 
   LPUNKNOWN pUnkSink, 
   BOOL bRefCount, 
   DWORD dwCookie  


A pointer to the object that calls the interface.


A pointer to the object that implements the interface.


The interface ID of the connection point interface.


TRUE indicates that disconnecting the connection should cause the reference count of pUnkSink to be decremented. FALSE indicates that the reference count should not be decremented.


The connection identifier returned by AfxConnectionAdvise.

Nonzero if a connection was disconnected; otherwise 0.

//mysink is a CCmdTarget-derived class supporting automation. 
//Get a pointer to sink's IUnknown, no AddRef done.
IID iid = IID_IUnknown;
IUnknown* pUnkSink = mysink.GetInterface(&iid);

//Terminate a connection between source and sink. 
//pUnkSrc is IUnknown of server obtained by CoCreateInstance(). 
//dwCookie is a value obtained through AfxConnectionAdvise().
AfxConnectionUnadvise(pUnkSrc, IID_ISampleSink, pUnkSink, FALSE, dwCookie);

Header: afxctl.h

Community Additions

© 2015 Microsoft