1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
HRESULT CSink::QueryInterface(REFIID riid, void ** ppvObj)
{
if (riid == IID_IUnknown){
*ppvObj = static_cast<void*>(this);
}
else if (riid == DIID_ICWOLEEvents){
*ppvObj = static_cast<ICWOLEEvents*>(this);
}
else if (riid == IID_IDispatch){
*ppvObj = static_cast<IDispatch*>(this);
}
else
{
char clsidStr[256];
WCHAR wClsidStr[256];
char txt[512];
StringFromGUID2(riid, (LPOLESTR)&wClsidStr, 256);
// Convert down to ANSI
WideCharToMultiByte(CP_ACP, 0, wClsidStr, -1, clsidStr, 256, NULL, NULL);
sprintf(txt, "riid is : %s: Unsupported Interface", clsidStr);
*ppvObj = NULL;
return E_NOINTERFACE;
}
static_cast<IUnknown*>(*ppvObj)->AddRef();
return S_OK;
}
/******************************************************************************/
STDMETHODIMP_(ULONG) CSink::AddRef()
{
return ++m_refCount;
}
/******************************************************************************/
STDMETHODIMP_(ULONG) CSink::AddRef()
{
return ++m_refCount;
}
/******************************************************************************/
STDMETHODIMP_(ULONG) CSink::Release()
{
if (--m_refCount == 0)
{
delete this;
return 0;
}
return m_refCount;
}
/******************************************************************************/
STDMETHODIMP CSink::GetTypeInfoCount(UINT *iTInfo)
{
return E_NOTIMPL;
}
/******************************************************************************/
STDMETHODIMP CSink::GetTypeInfo(UINT iTInfo, LCID lcid,
ITypeInfo **ppTInfo)
{
return E_NOTIMPL;
}
/******************************************************************************/
STDMETHODIMP CSink::GetIDsOfNames(REFIID riid,
OLECHAR **rgszNames,
UINT cNames, LCID lcid,
DISPID *rgDispId)
{
HRESULT hr = E_FAIL;
return hr;
}
/******************************************************************************/
STDMETHODIMP CSink::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
if ((riid != IID_NULL))
return E_INVALIDARG;
HRESULT hr = S_OK; // Initialize
return hr;
}
/******************************************************************************/
void CSink::OnShowMessageDlg(IMsgDlg *pIMsg, VARIANT_BOOL *Result){
// Is this correct???
}
|