Know when object advise
-
Hi I want to override IConnectionPointImpl advise so i can get the IUnkown of the object which hand it's sink which is the best,easy way to do it in ATL thanks tomer
-
Hi I want to override IConnectionPointImpl advise so i can get the IUnkown of the object which hand it's sink which is the best,easy way to do it in ATL thanks tomer
OK,I found a very simple solution... template class CAdviSeNotify: public IConnectionPointImpl { public: typedef IConnectionPointImpl baseClass; CAdviSeNotify(){}; virtual ~CAdviSeNotify(){}; STDMETHOD(Advise)(IUnknown* pUnkSink, DWORD* pdwCookie) { T* pT = static_cast(this); pT->OnClientAdvise(pUnkSink,piid); return baseClass::Advise(pUnkSink,pdwCookie); } STDMETHOD(Unadvise)(DWORD dwCookie) { T* pT = static_cast(this); return baseClass::Unadvise(dwCookie); } };