ReactOS 0.4.15-dev-8116-gf69e256
CDeskLinkDropHandler Class Reference

#include <CDeskLinkDropHandler.hpp>

Inheritance diagram for CDeskLinkDropHandler:
Collaboration diagram for CDeskLinkDropHandler:

Public Member Functions

 CDeskLinkDropHandler ()
 
 ~CDeskLinkDropHandler ()
 
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 13 of file CDeskLinkDropHandler.hpp.

Constructor & Destructor Documentation

◆ CDeskLinkDropHandler()

CDeskLinkDropHandler::CDeskLinkDropHandler ( )

Definition at line 12 of file CDeskLinkDropHandler.cpp.

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

◆ ~CDeskLinkDropHandler()

CDeskLinkDropHandler::~CDeskLinkDropHandler ( )

Definition at line 17 of file CDeskLinkDropHandler.cpp.

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

Member Function Documentation

◆ DragEnter()

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

Implements IDropTarget.

Definition at line 24 of file CDeskLinkDropHandler.cpp.

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

◆ DragLeave()

STDMETHODIMP CDeskLinkDropHandler::DragLeave ( void  )

Implements IDropTarget.

Definition at line 44 of file CDeskLinkDropHandler.cpp.

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

◆ DragOver()

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

Implements IDropTarget.

Definition at line 35 of file CDeskLinkDropHandler.cpp.

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

◆ Drop()

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

Implements IDropTarget.

Definition at line 51 of file CDeskLinkDropHandler.cpp.

53{
54 TRACE("(%p)\n", this);
55
56 if (!pDataObject)
57 {
58 ERR("pDataObject is NULL\n");
59 return E_POINTER;
60 }
61
62 WCHAR szDir[MAX_PATH], szDest[MAX_PATH], szSrc[MAX_PATH];
64
65 CComPtr<IShellFolder> pDesktop;
66 HRESULT hr = SHGetDesktopFolder(&pDesktop);
68 return hr;
69
70 CDataObjectHIDA pida(pDataObject);
71 if (FAILED_UNEXPECTEDLY(pida.hr()))
72 return pida.hr();
73
74 LPCITEMIDLIST pidlParent = HIDA_GetPIDLFolder(pida);
75 for (UINT i = 0; i < pida->cidl; ++i)
76 {
77 LPCITEMIDLIST pidlChild = HIDA_GetPIDLItem(pida, i);
78
79 CComHeapPtr<ITEMIDLIST> pidl(ILCombine(pidlParent, pidlChild));
80 if (!pidl)
81 {
82 ERR("Out of memory\n");
83 break;
84 }
85
86 StringCbCopyW(szDest, sizeof(szDest), szDir);
87 if (SHGetPathFromIDListW(pidl, szSrc))
88 {
89 LPCWSTR pszSourceExt;
90 BOOL bIsLink;
91
92 pszSourceExt = PathFindExtensionW(szSrc);
93 bIsLink = ((_wcsicmp(pszSourceExt, L".lnk") == 0) ||
94 (_wcsicmp(pszSourceExt, L".url") == 0));
95
96 if (bIsLink)
97 {
98 PathAppendW(szDest, PathFindFileNameW(szSrc));
99 }
100 else
101 {
102 CStringW strTitle;
103 strTitle.Format(IDS_SHORTCUT, PathFindFileNameW(szSrc));
104
105 PathAppendW(szDest, strTitle);
106 PathRemoveExtensionW(szDest);
107 StringCbCatW(szDest, sizeof(szDest), L".lnk");
108 }
109
110 if (PathFileExistsW(szDest))
111 {
112 CStringW strName(PathFindFileNameW(szDest));
113 PathYetAnotherMakeUniqueName(szDest, szDir, NULL, strName);
114 }
115
116 if (bIsLink)
117 {
118 hr = (CopyFileW(szSrc, szDest, TRUE) ? S_OK : E_FAIL);
119 }
120 else if (PathIsDirectoryW(szSrc) || (_wcsicmp(pszSourceExt, L".zip") == 0))
121 {
122 hr = CreateShellLink(szDest, szSrc, NULL, NULL, NULL, NULL, -1, NULL);
123 }
124 else
125 {
126 /* Set default working directory for the shortcut */
127 CStringW strWorkingDir(szSrc);
128 PathRemoveFileSpecW(strWorkingDir.GetBuffer());
129
130 hr = CreateShellLink(szDest, szSrc, NULL, NULL, strWorkingDir, NULL, -1, NULL);
131 }
132 }
133 else
134 {
135 STRRET strret;
136 hr = pDesktop->GetDisplayNameOf(pidl, SHGDN_INFOLDER, &strret);
138 break;
139
140 hr = StrRetToBufW(&strret, pidl, szSrc, _countof(szSrc));
142 break;
143
144 CStringW strTitle;
145 strTitle.Format(IDS_SHORTCUT, szSrc);
146
147 PathAppendW(szDest, strTitle);
148 PathRemoveExtensionW(szDest);
149 StringCbCatW(szDest, sizeof(szDest), L".lnk");
150
151 hr = CreateShellLink(szDest, NULL, pidl, NULL, NULL, NULL, -1, NULL);
152 }
153
155 break;
156 }
157
158 return hr;
159}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define ERR(fmt,...)
Definition: debug.h:113
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_SHORTCUT
Definition: resource.h:12
#define MAX_PATH
Definition: compat.h:34
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
Definition: shellpath.c:699
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3092
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
Definition: path.c:629
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:823
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1777
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1723
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1530
unsigned int BOOL
Definition: ntddk_ex.h:94
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
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define PathAppendW
Definition: pathcch.h:309
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1340
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HRESULT CreateShellLink(LPCWSTR pszLinkPath, LPCWSTR pszTargetPath OPTIONAL, LPCITEMIDLIST pidlTarget OPTIONAL, LPCWSTR pszArg OPTIONAL, LPCWSTR pszDir OPTIONAL, LPCWSTR pszIconPath OPTIONAL, INT iIconNr OPTIONAL, LPCWSTR pszComment OPTIONAL)
Definition: sendmail.cpp:102
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:589
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:584
HRESULT hr
Definition: shlfolder.c:183
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2174
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
#define E_POINTER
Definition: winerror.h:2365
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ GetClassID()

STDMETHODIMP CDeskLinkDropHandler::GetClassID ( CLSID lpClassId)

Implements IPersist.

Definition at line 192 of file CDeskLinkDropHandler.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_DeskLinkDropHandler;
203
204 return S_OK;
205}

◆ GetCurFile()

STDMETHODIMP CDeskLinkDropHandler::GetCurFile ( LPOLESTR ppszFileName)

Implements IPersistFile.

Definition at line 162 of file CDeskLinkDropHandler.cpp.

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

◆ IsDirty()

STDMETHODIMP CDeskLinkDropHandler::IsDirty ( void  )

Implements IPersistFile.

Definition at line 168 of file CDeskLinkDropHandler.cpp.

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

◆ Load()

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

Implements IPersistFile.

Definition at line 174 of file CDeskLinkDropHandler.cpp.

175{
176 return S_OK;
177}

◆ Save()

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

Implements IPersistFile.

Definition at line 179 of file CDeskLinkDropHandler.cpp.

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

◆ SaveCompleted()

STDMETHODIMP CDeskLinkDropHandler::SaveCompleted ( LPCOLESTR  pszFileName)

Implements IPersistFile.

Definition at line 185 of file CDeskLinkDropHandler.cpp.

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

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