ReactOS 0.4.15-dev-7942-gd23573b
MyIConnectionPointImpl< T, piid, CDV > Class Template Reference

#include <newatlinterfaces.h>

Inheritance diagram for MyIConnectionPointImpl< T, piid, CDV >:
Collaboration diagram for MyIConnectionPointImpl< T, piid, CDV >:

Public Member Functions

STDMETHODIMP Advise (IUnknown *pUnkSink, DWORD *pdwCookie)
 

Detailed Description

template<class T, const IID * piid, class CDV = CComDynamicUnkArray>
class MyIConnectionPointImpl< T, piid, CDV >

Definition at line 50 of file newatlinterfaces.h.

Member Function Documentation

◆ Advise()

template<class T , const IID * piid, class CDV = CComDynamicUnkArray>
STDMETHODIMP MyIConnectionPointImpl< T, piid, CDV >::Advise ( IUnknown pUnkSink,
DWORD pdwCookie 
)
inline

Definition at line 53 of file newatlinterfaces.h.

54 {
55 IConnectionPointImpl<T, piid, CDV> *pThisCPImpl;
56 T *pThis;
57 IUnknown *adviseSink;
58 DWORD newCookie;
59 HRESULT hResult;
60
61 pThis = static_cast<T *>(this);
62 pThisCPImpl = static_cast<IConnectionPointImpl<T, piid, CDV> *>(this);
63 if (pdwCookie != NULL)
64 *pdwCookie = 0;
65 if (pUnkSink == NULL || pdwCookie == NULL)
66 return E_POINTER;
67 hResult = pUnkSink->QueryInterface(IID_IDispatch, reinterpret_cast<void **>(&adviseSink));
68 if (FAILED(hResult))
69 {
70 if (hResult == E_NOINTERFACE)
72 return hResult;
73 }
74 pThis->Lock();
75 newCookie = pThisCPImpl->m_vec.Add(adviseSink);
76 pThis->Unlock();
77 *pdwCookie = newCookie;
78 if (newCookie != 0)
79 hResult = S_OK;
80 else
81 {
82 adviseSink->Release();
83 hResult = CONNECT_E_ADVISELIMIT;
84 }
85 return hResult;
86 }
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define T
Definition: mbstring.h:31
#define CONNECT_E_CANNOTCONNECT
Definition: olectl.h:253
#define CONNECT_E_ADVISELIMIT
Definition: olectl.h:252
const GUID IID_IDispatch
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365

The documentation for this class was generated from the following file: