mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
refeactor all IUnknown implementations using IComSrvBase
svn path=/trunk/; revision=18063
This commit is contained in:
parent
029ccdccaa
commit
8b950fec34
4 changed files with 121 additions and 216 deletions
|
@ -58,8 +58,7 @@ struct BrowserCallback
|
||||||
/// Implementation of IShellBrowserImpl interface in explorer child windows
|
/// Implementation of IShellBrowserImpl interface in explorer child windows
|
||||||
struct ShellBrowser : public IShellBrowserImpl
|
struct ShellBrowser : public IShellBrowserImpl
|
||||||
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
|
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
|
||||||
, public IComSrvBase<IShellFolderViewCB, ShellBrowser>,
|
, public IComSrvBase<IShellFolderViewCB, ShellBrowser>, public SimpleComObject
|
||||||
public SimpleComObject
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
|
ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
|
||||||
|
|
|
@ -530,9 +530,9 @@ interface FixedDWebBrowserEvents2 : public IDispatch
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ANSUNC DWebBrowserEvents2Impl : public SimpleComObject,
|
struct ANSUNC DWebBrowserEvents2Impl
|
||||||
public IComSrvBase<FixedDWebBrowserEvents2, DWebBrowserEvents2Impl>,
|
: public IComSrvBase<FixedDWebBrowserEvents2, DWebBrowserEvents2Impl>, public SimpleComObject,
|
||||||
public DWebBrowserEvents2IF
|
public DWebBrowserEvents2IF
|
||||||
{
|
{
|
||||||
typedef IComSrvBase<FixedDWebBrowserEvents2, DWebBrowserEvents2Impl> super;
|
typedef IComSrvBase<FixedDWebBrowserEvents2, DWebBrowserEvents2Impl> super;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
IDataObjectImpl::IDataObjectImpl(IDropSourceImpl* pDropSource)
|
IDataObjectImpl::IDataObjectImpl(IDropSourceImpl* pDropSource)
|
||||||
: m_pDropSource(pDropSource),
|
: super(IID_IDataObject),
|
||||||
|
m_pDropSource(pDropSource),
|
||||||
m_cRefCount(0)
|
m_cRefCount(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -33,37 +34,6 @@ IDataObjectImpl::~IDataObjectImpl()
|
||||||
ReleaseStgMedium(it->_medium);
|
ReleaseStgMedium(it->_medium);
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP IDataObjectImpl::QueryInterface(/* [in] */ REFIID riid,
|
|
||||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject)
|
|
||||||
{
|
|
||||||
*ppvObject = NULL;
|
|
||||||
if (IID_IUnknown==riid || IID_IDataObject==riid)
|
|
||||||
*ppvObject=this;
|
|
||||||
/*if (riid == IID_IAsyncOperation)
|
|
||||||
*ppvObject=(IAsyncOperation*)this;*/
|
|
||||||
if (NULL!=*ppvObject)
|
|
||||||
{
|
|
||||||
((LPUNKNOWN)*ppvObject)->AddRef();
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(ULONG) IDataObjectImpl::AddRef()
|
|
||||||
{
|
|
||||||
return ++m_cRefCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(ULONG) IDataObjectImpl::Release()
|
|
||||||
{
|
|
||||||
long nTemp = --m_cRefCount;
|
|
||||||
|
|
||||||
if (nTemp == 0)
|
|
||||||
delete this;
|
|
||||||
|
|
||||||
return nTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP IDataObjectImpl::GetData(
|
STDMETHODIMP IDataObjectImpl::GetData(
|
||||||
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetcIn,
|
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetcIn,
|
||||||
/* [out] */ STGMEDIUM __RPC_FAR *pmedium)
|
/* [out] */ STGMEDIUM __RPC_FAR *pmedium)
|
||||||
|
@ -255,38 +225,6 @@ HRESULT STDMETHODCALLTYPE IDataObjectImpl::EnumDAdvise(
|
||||||
// IDropSourceImpl Class
|
// IDropSourceImpl Class
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
STDMETHODIMP IDropSourceImpl::QueryInterface(/* [in] */ REFIID riid,
|
|
||||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject)
|
|
||||||
{
|
|
||||||
*ppvObject = NULL;
|
|
||||||
if (IID_IUnknown==riid || IID_IDropSource==riid)
|
|
||||||
*ppvObject=this;
|
|
||||||
|
|
||||||
if (*ppvObject != NULL)
|
|
||||||
{
|
|
||||||
((LPUNKNOWN)*ppvObject)->AddRef();
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(ULONG) IDropSourceImpl::AddRef()
|
|
||||||
{
|
|
||||||
return ++m_cRefCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(ULONG) IDropSourceImpl::Release()
|
|
||||||
{
|
|
||||||
long nTemp = --m_cRefCount;
|
|
||||||
|
|
||||||
assert(nTemp >= 0);
|
|
||||||
|
|
||||||
if (nTemp == 0)
|
|
||||||
delete this;
|
|
||||||
|
|
||||||
return nTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP IDropSourceImpl::QueryContinueDrag(
|
STDMETHODIMP IDropSourceImpl::QueryContinueDrag(
|
||||||
/* [in] */ BOOL fEscapePressed,
|
/* [in] */ BOOL fEscapePressed,
|
||||||
/* [in] */ DWORD grfKeyState)
|
/* [in] */ DWORD grfKeyState)
|
||||||
|
@ -314,7 +252,8 @@ STDMETHODIMP IDropSourceImpl::GiveFeedback(
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
EnumFormatEtcImpl::EnumFormatEtcImpl(const FormatArray& ArrFE)
|
EnumFormatEtcImpl::EnumFormatEtcImpl(const FormatArray& ArrFE)
|
||||||
: m_cRefCount(0),
|
: super(IID_IEnumFORMATETC),
|
||||||
|
m_cRefCount(0),
|
||||||
m_iCur(0)
|
m_iCur(0)
|
||||||
{
|
{
|
||||||
for(FormatArray::const_iterator it=ArrFE.begin(); it!=ArrFE.end(); ++it)
|
for(FormatArray::const_iterator it=ArrFE.begin(); it!=ArrFE.end(); ++it)
|
||||||
|
@ -322,45 +261,15 @@ EnumFormatEtcImpl::EnumFormatEtcImpl(const FormatArray& ArrFE)
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumFormatEtcImpl::EnumFormatEtcImpl(const StorageArray& ArrFE)
|
EnumFormatEtcImpl::EnumFormatEtcImpl(const StorageArray& ArrFE)
|
||||||
: m_cRefCount(0),
|
: super(IID_IEnumFORMATETC),
|
||||||
|
m_cRefCount(0),
|
||||||
m_iCur(0)
|
m_iCur(0)
|
||||||
{
|
{
|
||||||
for(StorageArray::const_iterator it=ArrFE.begin(); it!=ArrFE.end(); ++it)
|
for(StorageArray::const_iterator it=ArrFE.begin(); it!=ArrFE.end(); ++it)
|
||||||
m_pFmtEtc.push_back(*it->_format);
|
m_pFmtEtc.push_back(*it->_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP EnumFormatEtcImpl::QueryInterface(REFIID refiid, void** ppv)
|
STDMETHODIMP EnumFormatEtcImpl::Next(ULONG celt,LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
|
||||||
{
|
|
||||||
*ppv = NULL;
|
|
||||||
if (IID_IUnknown==refiid || IID_IEnumFORMATETC==refiid)
|
|
||||||
*ppv=this;
|
|
||||||
|
|
||||||
if (*ppv != NULL)
|
|
||||||
{
|
|
||||||
((LPUNKNOWN)*ppv)->AddRef();
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(ULONG) EnumFormatEtcImpl::AddRef(void)
|
|
||||||
{
|
|
||||||
return ++m_cRefCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(ULONG) EnumFormatEtcImpl::Release(void)
|
|
||||||
{
|
|
||||||
long nTemp = --m_cRefCount;
|
|
||||||
|
|
||||||
assert(nTemp >= 0);
|
|
||||||
|
|
||||||
if (nTemp == 0)
|
|
||||||
delete this;
|
|
||||||
|
|
||||||
return nTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP EnumFormatEtcImpl::Next( ULONG celt,LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
|
|
||||||
{
|
{
|
||||||
if (pceltFetched != NULL)
|
if (pceltFetched != NULL)
|
||||||
*pceltFetched=0;
|
*pceltFetched=0;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
PARTICULAR PURPOSE.
|
PARTICULAR PURPOSE.
|
||||||
Author: Leon Finker 11/2000
|
Author: Leon Finker 11/2000
|
||||||
Modifications: replaced ATL by STL, Martin Fuchs 7/2003
|
Modifications: replaced ATL by STL, Martin Fuchs 7/2003
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
@ -24,60 +24,64 @@ typedef vector<DataStorage> StorageArray;
|
||||||
|
|
||||||
|
|
||||||
/// implementation of IEnumFORMATETC interface
|
/// implementation of IEnumFORMATETC interface
|
||||||
class EnumFormatEtcImpl : public IEnumFORMATETC
|
class EnumFormatEtcImpl
|
||||||
|
: public IComSrvBase<IEnumFORMATETC, EnumFormatEtcImpl>, public SimpleComObject
|
||||||
{
|
{
|
||||||
private:
|
typedef IComSrvBase<IEnumFORMATETC, EnumFormatEtcImpl> super;
|
||||||
ULONG m_cRefCount;
|
|
||||||
FormatArray m_pFmtEtc;
|
|
||||||
size_t m_iCur;
|
|
||||||
|
|
||||||
public:
|
private:
|
||||||
EnumFormatEtcImpl(const FormatArray& ArrFE);
|
ULONG m_cRefCount;
|
||||||
|
FormatArray m_pFmtEtc;
|
||||||
|
size_t m_iCur;
|
||||||
|
|
||||||
|
public:
|
||||||
|
EnumFormatEtcImpl(const FormatArray& ArrFE);
|
||||||
EnumFormatEtcImpl(const StorageArray& ArrFE);
|
EnumFormatEtcImpl(const StorageArray& ArrFE);
|
||||||
virtual ~EnumFormatEtcImpl() {}
|
virtual ~EnumFormatEtcImpl() {}
|
||||||
|
|
||||||
//IUnknown members
|
//IEnumFORMATETC members
|
||||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void**);
|
virtual HRESULT STDMETHODCALLTYPE Next(ULONG, LPFORMATETC, ULONG*);
|
||||||
virtual ULONG STDMETHODCALLTYPE AddRef(void);
|
virtual HRESULT STDMETHODCALLTYPE Skip(ULONG);
|
||||||
virtual ULONG STDMETHODCALLTYPE Release(void);
|
virtual HRESULT STDMETHODCALLTYPE Reset(void);
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE Clone(IEnumFORMATETC**);
|
||||||
//IEnumFORMATETC members
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE Next(ULONG, LPFORMATETC, ULONG*);
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE Skip(ULONG);
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE Reset(void);
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE Clone(IEnumFORMATETC**);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// implementation of IDropSource interface
|
/// implementation of IDropSource interface
|
||||||
class IDropSourceImpl : public IDropSource
|
class IDropSourceImpl
|
||||||
|
: public IComSrvBase<IDropSource, IDropSourceImpl>, public SimpleComObject
|
||||||
{
|
{
|
||||||
|
typedef IComSrvBase<IDropSource, IDropSourceImpl> super;
|
||||||
|
|
||||||
long m_cRefCount;
|
long m_cRefCount;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool m_bDropped;
|
bool m_bDropped;
|
||||||
|
|
||||||
IDropSourceImpl::IDropSourceImpl() : m_cRefCount(0), m_bDropped(false) {}
|
IDropSourceImpl()
|
||||||
|
: super(IID_IDropSource),
|
||||||
|
m_cRefCount(0),
|
||||||
|
m_bDropped(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~IDropSourceImpl() {}
|
virtual ~IDropSourceImpl() {}
|
||||||
|
|
||||||
//IUnknown
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
|
|
||||||
/* [in] */ REFIID riid,
|
|
||||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
|
|
||||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
|
||||||
virtual ULONG STDMETHODCALLTYPE Release();
|
|
||||||
|
|
||||||
//IDropSource
|
//IDropSource
|
||||||
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(
|
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(
|
||||||
/* [in] */ BOOL fEscapePressed,
|
/* [in] */ BOOL fEscapePressed,
|
||||||
/* [in] */ DWORD grfKeyState);
|
/* [in] */ DWORD grfKeyState);
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE GiveFeedback(
|
virtual HRESULT STDMETHODCALLTYPE GiveFeedback(
|
||||||
/* [in] */ DWORD dwEffect);
|
/* [in] */ DWORD dwEffect);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// implementation of IDataObject interface
|
/// implementation of IDataObject interface
|
||||||
class IDataObjectImpl : public IDataObject//,public IAsyncOperation
|
class IDataObjectImpl
|
||||||
|
: public IComSrvBase<IDataObject, IDataObjectImpl>, public SimpleComObject
|
||||||
|
//public IAsyncOperation
|
||||||
{
|
{
|
||||||
|
typedef IComSrvBase<IDataObject, IDataObjectImpl> super;
|
||||||
|
|
||||||
IDropSourceImpl* m_pDropSource;
|
IDropSourceImpl* m_pDropSource;
|
||||||
long m_cRefCount;
|
long m_cRefCount;
|
||||||
|
|
||||||
|
@ -89,79 +93,72 @@ public:
|
||||||
|
|
||||||
void CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc);
|
void CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc);
|
||||||
|
|
||||||
//IUnknown
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
|
|
||||||
/* [in] */ REFIID riid,
|
|
||||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
|
|
||||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
|
||||||
virtual ULONG STDMETHODCALLTYPE Release();
|
|
||||||
|
|
||||||
//IDataObject
|
//IDataObject
|
||||||
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetData(
|
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetData(
|
||||||
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetcIn,
|
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetcIn,
|
||||||
/* [out] */ STGMEDIUM __RPC_FAR *pmedium);
|
/* [out] */ STGMEDIUM __RPC_FAR *pmedium);
|
||||||
|
|
||||||
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetDataHere(
|
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetDataHere(
|
||||||
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetc,
|
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetc,
|
||||||
/* [out][in] */ STGMEDIUM __RPC_FAR *pmedium);
|
/* [out][in] */ STGMEDIUM __RPC_FAR *pmedium);
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE QueryGetData(
|
virtual HRESULT STDMETHODCALLTYPE QueryGetData(
|
||||||
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetc);
|
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetc);
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(
|
virtual HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(
|
||||||
/* [unique][in] */ FORMATETC __RPC_FAR *pformatectIn,
|
/* [unique][in] */ FORMATETC __RPC_FAR *pformatectIn,
|
||||||
/* [out] */ FORMATETC __RPC_FAR *pformatetcOut);
|
/* [out] */ FORMATETC __RPC_FAR *pformatetcOut);
|
||||||
|
|
||||||
virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetData(
|
virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetData(
|
||||||
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetc,
|
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetc,
|
||||||
/* [unique][in] */ STGMEDIUM __RPC_FAR *pmedium,
|
/* [unique][in] */ STGMEDIUM __RPC_FAR *pmedium,
|
||||||
/* [in] */ BOOL fRelease);
|
/* [in] */ BOOL fRelease);
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE EnumFormatEtc(
|
virtual HRESULT STDMETHODCALLTYPE EnumFormatEtc(
|
||||||
/* [in] */ DWORD dwDirection,
|
/* [in] */ DWORD dwDirection,
|
||||||
/* [out] */ IEnumFORMATETC __RPC_FAR *__RPC_FAR *ppenumFormatEtc);
|
/* [out] */ IEnumFORMATETC __RPC_FAR *__RPC_FAR *ppenumFormatEtc);
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE DAdvise(
|
virtual HRESULT STDMETHODCALLTYPE DAdvise(
|
||||||
/* [in] */ FORMATETC __RPC_FAR *pformatetc,
|
/* [in] */ FORMATETC __RPC_FAR *pformatetc,
|
||||||
/* [in] */ DWORD advf,
|
/* [in] */ DWORD advf,
|
||||||
/* [unique][in] */ IAdviseSink __RPC_FAR *pAdvSink,
|
/* [unique][in] */ IAdviseSink __RPC_FAR *pAdvSink,
|
||||||
/* [out] */ DWORD __RPC_FAR *pdwConnection);
|
/* [out] */ DWORD __RPC_FAR *pdwConnection);
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE DUnadvise(
|
virtual HRESULT STDMETHODCALLTYPE DUnadvise(
|
||||||
/* [in] */ DWORD dwConnection);
|
/* [in] */ DWORD dwConnection);
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE EnumDAdvise(
|
virtual HRESULT STDMETHODCALLTYPE EnumDAdvise(
|
||||||
/* [out] */ IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise);
|
/* [out] */ IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise);
|
||||||
|
|
||||||
//IAsyncOperation
|
//IAsyncOperation
|
||||||
//virtual HRESULT STDMETHODCALLTYPE SetAsyncMode(
|
//virtual HRESULT STDMETHODCALLTYPE SetAsyncMode(
|
||||||
// /* [in] */ BOOL fDoOpAsync)
|
// /* [in] */ BOOL fDoOpAsync)
|
||||||
//{
|
//{
|
||||||
// return E_NOTIMPL;
|
// return E_NOTIMPL;
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//virtual HRESULT STDMETHODCALLTYPE GetAsyncMode(
|
//virtual HRESULT STDMETHODCALLTYPE GetAsyncMode(
|
||||||
// /* [out] */ BOOL __RPC_FAR *pfIsOpAsync)
|
// /* [out] */ BOOL __RPC_FAR *pfIsOpAsync)
|
||||||
//{
|
//{
|
||||||
// return E_NOTIMPL;
|
// return E_NOTIMPL;
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//virtual HRESULT STDMETHODCALLTYPE StartOperation(
|
//virtual HRESULT STDMETHODCALLTYPE StartOperation(
|
||||||
// /* [optional][unique][in] */ IBindCtx __RPC_FAR *pbcReserved)
|
// /* [optional][unique][in] */ IBindCtx __RPC_FAR *pbcReserved)
|
||||||
//{
|
//{
|
||||||
// return E_NOTIMPL;
|
// return E_NOTIMPL;
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//virtual HRESULT STDMETHODCALLTYPE InOperation(
|
//virtual HRESULT STDMETHODCALLTYPE InOperation(
|
||||||
// /* [out] */ BOOL __RPC_FAR *pfInAsyncOp)
|
// /* [out] */ BOOL __RPC_FAR *pfInAsyncOp)
|
||||||
//{
|
//{
|
||||||
// return E_NOTIMPL;
|
// return E_NOTIMPL;
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//virtual HRESULT STDMETHODCALLTYPE EndOperation(
|
//virtual HRESULT STDMETHODCALLTYPE EndOperation(
|
||||||
// /* [in] */ HRESULT hResult,
|
// /* [in] */ HRESULT hResult,
|
||||||
// /* [unique][in] */ IBindCtx __RPC_FAR *pbcReserved,
|
// /* [unique][in] */ IBindCtx __RPC_FAR *pbcReserved,
|
||||||
// /* [in] */ DWORD dwEffects)
|
// /* [in] */ DWORD dwEffects)
|
||||||
//{
|
//{
|
||||||
// return E_NOTIMPL;
|
// return E_NOTIMPL;
|
||||||
//}*/
|
//}*/
|
||||||
|
@ -195,22 +192,22 @@ public:
|
||||||
virtual ULONG STDMETHODCALLTYPE AddRef() {return ++m_cRefCount;}
|
virtual ULONG STDMETHODCALLTYPE AddRef() {return ++m_cRefCount;}
|
||||||
virtual ULONG STDMETHODCALLTYPE Release();
|
virtual ULONG STDMETHODCALLTYPE Release();
|
||||||
|
|
||||||
bool QueryDrop(DWORD grfKeyState, LPDWORD pdwEffect);
|
bool QueryDrop(DWORD grfKeyState, LPDWORD pdwEffect);
|
||||||
virtual HRESULT STDMETHODCALLTYPE DragEnter(
|
virtual HRESULT STDMETHODCALLTYPE DragEnter(
|
||||||
/* [unique][in] */ IDataObject __RPC_FAR *pDataObj,
|
/* [unique][in] */ IDataObject __RPC_FAR *pDataObj,
|
||||||
/* [in] */ DWORD grfKeyState,
|
/* [in] */ DWORD grfKeyState,
|
||||||
/* [in] */ POINTL pt,
|
/* [in] */ POINTL pt,
|
||||||
/* [out][in] */ DWORD __RPC_FAR *pdwEffect);
|
/* [out][in] */ DWORD __RPC_FAR *pdwEffect);
|
||||||
virtual HRESULT STDMETHODCALLTYPE DragOver(
|
virtual HRESULT STDMETHODCALLTYPE DragOver(
|
||||||
/* [in] */ DWORD grfKeyState,
|
/* [in] */ DWORD grfKeyState,
|
||||||
/* [in] */ POINTL pt,
|
/* [in] */ POINTL pt,
|
||||||
/* [out][in] */ DWORD __RPC_FAR *pdwEffect);
|
/* [out][in] */ DWORD __RPC_FAR *pdwEffect);
|
||||||
virtual HRESULT STDMETHODCALLTYPE DragLeave();
|
virtual HRESULT STDMETHODCALLTYPE DragLeave();
|
||||||
virtual HRESULT STDMETHODCALLTYPE Drop(
|
virtual HRESULT STDMETHODCALLTYPE Drop(
|
||||||
/* [unique][in] */ IDataObject __RPC_FAR *pDataObj,
|
/* [unique][in] */ IDataObject __RPC_FAR *pDataObj,
|
||||||
/* [in] */ DWORD grfKeyState,
|
/* [in] */ DWORD grfKeyState,
|
||||||
/* [in] */ POINTL pt,
|
/* [in] */ POINTL pt,
|
||||||
/* [out][in] */ DWORD __RPC_FAR *pdwEffect);
|
/* [out][in] */ DWORD __RPC_FAR *pdwEffect);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// implementation of IDragSourceHelper interface
|
/// implementation of IDragSourceHelper interface
|
||||||
|
@ -222,10 +219,10 @@ public:
|
||||||
DragSourceHelper()
|
DragSourceHelper()
|
||||||
{
|
{
|
||||||
if (FAILED(CoCreateInstance(CLSID_DragDropHelper,
|
if (FAILED(CoCreateInstance(CLSID_DragDropHelper,
|
||||||
NULL,
|
NULL,
|
||||||
CLSCTX_INPROC_SERVER,
|
CLSCTX_INPROC_SERVER,
|
||||||
IID_IDragSourceHelper,
|
IID_IDragSourceHelper,
|
||||||
(void**)&pDragSourceHelper)))
|
(void**)&pDragSourceHelper)))
|
||||||
pDragSourceHelper = NULL;
|
pDragSourceHelper = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +236,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// IDragSourceHelper
|
// IDragSourceHelper
|
||||||
HRESULT InitializeFromBitmap(HBITMAP hBitmap,
|
HRESULT InitializeFromBitmap(HBITMAP hBitmap,
|
||||||
POINT& pt, // cursor position in client coords of the window
|
POINT& pt, // cursor position in client coords of the window
|
||||||
RECT& rc, // selected item's bounding rect
|
RECT& rc, // selected item's bounding rect
|
||||||
IDataObject* pDataObject,
|
IDataObject* pDataObject,
|
||||||
|
@ -249,19 +246,19 @@ public:
|
||||||
if (pDragSourceHelper == NULL)
|
if (pDragSourceHelper == NULL)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
SHDRAGIMAGE di;
|
SHDRAGIMAGE di;
|
||||||
BITMAP bm;
|
BITMAP bm;
|
||||||
GetObject(hBitmap, sizeof(bm), &bm);
|
GetObject(hBitmap, sizeof(bm), &bm);
|
||||||
di.sizeDragImage.cx = bm.bmWidth;
|
di.sizeDragImage.cx = bm.bmWidth;
|
||||||
di.sizeDragImage.cy = bm.bmHeight;
|
di.sizeDragImage.cy = bm.bmHeight;
|
||||||
di.hbmpDragImage = hBitmap;
|
di.hbmpDragImage = hBitmap;
|
||||||
di.crColorKey = crColorKey;
|
di.crColorKey = crColorKey;
|
||||||
di.ptOffset.x = pt.x - rc.left;
|
di.ptOffset.x = pt.x - rc.left;
|
||||||
di.ptOffset.y = pt.y - rc.top;
|
di.ptOffset.y = pt.y - rc.top;
|
||||||
return pDragSourceHelper->InitializeFromBitmap(&di, pDataObject);
|
return pDragSourceHelper->InitializeFromBitmap(&di, pDataObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT InitializeFromWindow(HWND hwnd, POINT& pt,IDataObject* pDataObject)
|
HRESULT InitializeFromWindow(HWND hwnd, POINT& pt,IDataObject* pDataObject)
|
||||||
{
|
{
|
||||||
if (pDragSourceHelper == NULL)
|
if (pDragSourceHelper == NULL)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
Loading…
Reference in a new issue