ReactOS 0.4.15-dev-7953-g1f49173
CMyDocsDropHandler Class Reference

#include <CMyDocsDropHandler.hpp>

Inheritance diagram for CMyDocsDropHandler:
Collaboration diagram for CMyDocsDropHandler:

Public Member Functions

 CMyDocsDropHandler ()
 
 ~CMyDocsDropHandler ()
 
STDMETHODIMP DragEnter (IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
 
STDMETHODIMP DragOver (DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
 
STDMETHODIMP DragLeave ()
 
STDMETHODIMP Drop (IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
 
STDMETHODIMP GetClassID (CLSID *lpClassId)
 
STDMETHODIMP GetCurFile (LPOLESTR *ppszFileName)
 
STDMETHODIMP IsDirty ()
 
STDMETHODIMP Load (LPCOLESTR pszFileName, DWORD dwMode)
 
STDMETHODIMP Save (LPCOLESTR pszFileName, BOOL fRemember)
 
STDMETHODIMP SaveCompleted (LPCOLESTR pszFileName)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
HRESULT DragEnter ([in, unique] IDataObject *pDataObj, [in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
HRESULT DragOver ([in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
HRESULT DragLeave ()
 
HRESULT Drop ([in, unique] IDataObject *pDataObj, [in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
HRESULT IsDirty ()
 
HRESULT Load ([in] LPCOLESTR pszFileName, [in] DWORD dwMode)
 
HRESULT Save ([in, unique] LPCOLESTR pszFileName, [in] BOOL fRemember)
 
HRESULT SaveCompleted ([in, unique] LPCOLESTR pszFileName)
 
HRESULT GetCurFile ([out] LPOLESTR *ppszFileName)
 
HRESULT GetClassID ([out] CLSID *pClassID)
 

Additional Inherited Members

- Public Types inherited from IDropTarget
typedef IDropTargetLPDROPTARGET
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IPersistFile
typedef IPersistFileLPPERSISTFILE
 
- Public Types inherited from IPersist
typedef IPersistLPPERSIST
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from IDropTarget
const DWORD MK_ALT = 0x20
 
const DWORD DROPEFFECT_NONE = 0
 
const DWORD DROPEFFECT_COPY = 1
 
const DWORD DROPEFFECT_MOVE = 2
 
const DWORD DROPEFFECT_LINK = 4
 
const DWORD DROPEFFECT_SCROLL = 0x80000000
 
const DWORD DD_DEFSCROLLINSET = 11
 
const DWORD DD_DEFSCROLLDELAY = 50
 
const DWORD DD_DEFSCROLLINTERVAL = 50
 
const DWORD DD_DEFDRAGDELAY = 200
 
const DWORD DD_DEFDRAGMINDIST = 2
 

Detailed Description

Definition at line 12 of file CMyDocsDropHandler.hpp.

Constructor & Destructor Documentation

◆ CMyDocsDropHandler()

CMyDocsDropHandler::CMyDocsDropHandler ( )

Definition at line 12 of file CMyDocsDropHandler.cpp.

13{
15}
LONG g_ModuleRefCnt
Definition: ACPPage.cpp:13
#define InterlockedIncrement
Definition: armddk.h:53

◆ ~CMyDocsDropHandler()

CMyDocsDropHandler::~CMyDocsDropHandler ( )

Definition at line 17 of file CMyDocsDropHandler.cpp.

18{
20}
#define InterlockedDecrement
Definition: armddk.h:52

Member Function Documentation

◆ DragEnter()

STDMETHODIMP CMyDocsDropHandler::DragEnter ( IDataObject pDataObject,
DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)

Implements IDropTarget.

Definition at line 24 of file CMyDocsDropHandler.cpp.

26{
27 TRACE("(%p)\n", this);
28
29 *pdwEffect &= DROPEFFECT_COPY; // Copy only
30
31 return S_OK;
32}
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
#define S_OK
Definition: intsafe.h:52
#define TRACE(s)
Definition: solgame.cpp:4

◆ DragLeave()

STDMETHODIMP CMyDocsDropHandler::DragLeave ( void  )

Implements IDropTarget.

Definition at line 44 of file CMyDocsDropHandler.cpp.

45{
46 TRACE("(%p)\n", this);
47 return S_OK;
48}

Referenced by Drop().

◆ DragOver()

STDMETHODIMP CMyDocsDropHandler::DragOver ( DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)

Implements IDropTarget.

Definition at line 35 of file CMyDocsDropHandler.cpp.

36{
37 TRACE("(%p)\n", this);
38
39 *pdwEffect &= DROPEFFECT_COPY; // Copy only
40
41 return S_OK;
42}

◆ Drop()

STDMETHODIMP CMyDocsDropHandler::Drop ( IDataObject pDataObject,
DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)

Implements IDropTarget.

Definition at line 51 of file CMyDocsDropHandler.cpp.

53{
54 TRACE("(%p)\n", this);
55
56 if (!pDataObject)
57 {
58 ERR("pDataObject is NULL\n");
59 *pdwEffect = 0;
60 DragLeave();
61 return E_POINTER;
62 }
63
64 CComPtr<IShellFolder> pDesktop;
65 HRESULT hr = SHGetDesktopFolder(&pDesktop);
67 return hr;
68
69 // Retrieve an HIDA (handle of IDA)
70 CDataObjectHIDA pida(pDataObject);
71 if (FAILED_UNEXPECTEDLY(pida.hr()))
72 {
73 *pdwEffect = 0;
74 DragLeave();
75 return pida.hr();
76 }
77
78 UINT iItem, cItems = pida->cidl;
79
80 // get the path of "My Documents"
81 WCHAR szzDir[MAX_PATH + 1];
83 szzDir[lstrlenW(szzDir) + 1] = 0; // ends with double NULs
84
85 // for all source items
86 CStringW strSrcList;
87 WCHAR szSrc[MAX_PATH];
88 PCIDLIST_ABSOLUTE pidlParent = HIDA_GetPIDLFolder(pida);
89 for (iItem = 0; iItem < cItems; ++iItem)
90 {
91 // query source pidl
92 PCITEMID_CHILD pidlChild = HIDA_GetPIDLItem(pida, iItem);
93 CComHeapPtr<ITEMIDLIST> pidl(ILCombine(pidlParent, pidlChild));
94
95 // can get path?
96 szSrc[0] = 0;
97 if (!SHGetPathFromIDListW(pidl, szSrc))
98 {
99 // try to retrieve path from desktop
100 STRRET strret;
101 hr = pDesktop->GetDisplayNameOf(pidl, SHGDN_INFOLDER, &strret);
103 break;
104 hr = StrRetToBufW(&strret, pidl, szSrc, _countof(szSrc));
106 break;
107 if (!PathFileExistsW(szSrc))
108 break;
109 }
110
111 if (iItem > 0)
112 strSrcList += L'|'; // separator is '|'
113 strSrcList += szSrc;
114 }
115
116 if (iItem != cItems)
117 {
118 // source not found
119 CStringW strText;
120 strText.Format(IDS_NOSRCFILEFOUND, szSrc[0] ? szSrc : L"(null)");
121 MessageBoxW(NULL, strText, NULL, MB_ICONERROR);
122
123 *pdwEffect = 0;
124 DragLeave();
125 return E_FAIL;
126 }
127
128 strSrcList += L"||"; // double separators
129
130 // lock the buffer
131 LPWSTR pszzSrcList = strSrcList.GetBuffer();
132
133 // convert every separator to a NUL
134 INT cch = strSrcList.GetLength();
135 for (INT i = 0; i < cch; ++i)
136 {
137 if (pszzSrcList[i] == L'|')
138 pszzSrcList[i] = L'\0';
139 }
140
141 // copy them
142 SHFILEOPSTRUCTW fileop = { NULL };
143 fileop.wFunc = FO_COPY;
144 fileop.pFrom = pszzSrcList;
145 fileop.pTo = szzDir;
147 int res = SHFileOperationW(&fileop);
148 if (res)
149 {
150 ERR("SHFileOperationW failed with 0x%x\n", res);
151 hr = E_FAIL;
152 }
153
154 // unlock buffer
155 strSrcList.ReleaseBuffer();
156
157 DragLeave();
158 return hr;
159}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define ERR(fmt,...)
Definition: debug.h:110
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:387
int GetLength() const noexcept
Definition: atlsimpstr.h:362
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
STDMETHODIMP DragLeave()
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define IDS_NOSRCFILEFOUND
Definition: resource.h:13
#define MAX_PATH
Definition: compat.h:34
#define lstrlenW
Definition: compat.h:750
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3092
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1777
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1530
GLuint res
Definition: glext.h:9613
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1353
#define FOF_MULTIDESTFILES
Definition: shellapi.h:141
#define FOF_ALLOWUNDO
Definition: shellapi.h:147
#define FO_COPY
Definition: shellapi.h:137
#define FOF_FILESONLY
Definition: shellapi.h:148
#define FOF_NOCONFIRMMKDIR
Definition: shellapi.h:150
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:591
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:586
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:1987
HRESULT hr
Definition: shlfolder.c:183
#define CSIDL_PERSONAL
Definition: shlobj.h:2163
#define _countof(array)
Definition: sndvol32.h:68
LPCWSTR pFrom
Definition: shellapi.h:357
FILEOP_FLAGS fFlags
Definition: shellapi.h:359
int32_t INT
Definition: typedefs.h:58
#define E_POINTER
Definition: winerror.h:2365
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:787
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ GetClassID()

STDMETHODIMP CMyDocsDropHandler::GetClassID ( CLSID lpClassId)

Implements IPersist.

Definition at line 192 of file CMyDocsDropHandler.cpp.

193{
194 TRACE("(%p)\n", this);
195
196 if (!lpClassId)
197 {
198 ERR("lpClassId is NULL\n");
199 return E_POINTER;
200 }
201
202 *lpClassId = CLSID_MyDocsDropHandler;
203
204 return S_OK;
205}

◆ GetCurFile()

STDMETHODIMP CMyDocsDropHandler::GetCurFile ( LPOLESTR ppszFileName)

Implements IPersistFile.

Definition at line 162 of file CMyDocsDropHandler.cpp.

163{
164 FIXME("(%p)\n", this);
165 return E_NOTIMPL;
166}
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IsDirty()

STDMETHODIMP CMyDocsDropHandler::IsDirty ( void  )

Implements IPersistFile.

Definition at line 168 of file CMyDocsDropHandler.cpp.

169{
170 FIXME("(%p)\n", this);
171 return E_NOTIMPL;
172}

◆ Load()

STDMETHODIMP CMyDocsDropHandler::Load ( LPCOLESTR  pszFileName,
DWORD  dwMode 
)

Implements IPersistFile.

Definition at line 174 of file CMyDocsDropHandler.cpp.

175{
176 return S_OK;
177}

◆ Save()

STDMETHODIMP CMyDocsDropHandler::Save ( LPCOLESTR  pszFileName,
BOOL  fRemember 
)

Implements IPersistFile.

Definition at line 179 of file CMyDocsDropHandler.cpp.

180{
181 FIXME("(%p)\n", this);
182 return E_NOTIMPL;
183}

◆ SaveCompleted()

STDMETHODIMP CMyDocsDropHandler::SaveCompleted ( LPCOLESTR  pszFileName)

Implements IPersistFile.

Definition at line 185 of file CMyDocsDropHandler.cpp.

186{
187 FIXME("(%p)\n", this);
188 return E_NOTIMPL;
189}

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