ReactOS  0.4.14-dev-815-ge410a12
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 ()
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

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 }
LONG g_ModuleRefCnt
Definition: ACPPage.cpp:13
#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 }
#define TRACE(s)
Definition: solgame.cpp:4
const DWORD DROPEFFECT_LINK
Definition: oleidl.idl:932
#define S_OK
Definition: intsafe.h:59

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4
const DWORD DROPEFFECT_LINK
Definition: oleidl.idl:932
#define S_OK
Definition: intsafe.h:59

◆ 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  FORMATETC fmt;
64  fmt.ptd = NULL;
65  fmt.dwAspect = DVASPECT_CONTENT;
66  fmt.lindex = -1;
67  fmt.tymed = TYMED_HGLOBAL;
68 
69  WCHAR szDir[MAX_PATH], szDest[MAX_PATH], szSrc[MAX_PATH];
71 
72  CComPtr<IShellFolder> pDesktop;
73  HRESULT hr = SHGetDesktopFolder(&pDesktop);
75  return hr;
76 
77  STGMEDIUM medium;
78  hr = pDataObject->GetData(&fmt, &medium);
80  return hr;
81 
82  LPIDA pida = reinterpret_cast<LPIDA>(GlobalLock(medium.hGlobal));
83  if (!pida)
84  {
85  ERR("Error locking global\n");
86  ReleaseStgMedium(&medium);
87  return E_FAIL;
88  }
89 
90  LPBYTE pb = reinterpret_cast<LPBYTE>(pida);
91  LPCITEMIDLIST pidlParent = reinterpret_cast<LPCITEMIDLIST>(pb + pida->aoffset[0]);
92  for (UINT i = 1; i <= pida->cidl; ++i)
93  {
94  LPCITEMIDLIST pidlChild = reinterpret_cast<LPCITEMIDLIST>(pb + pida->aoffset[i]);
95 
96  CComHeapPtr<ITEMIDLIST> pidl(ILCombine(pidlParent, pidlChild));
97  if (!pidl)
98  {
99  ERR("Out of memory\n");
100  break;
101  }
102 
103  StringCbCopyW(szDest, sizeof(szDest), szDir);
104  if (SHGetPathFromIDListW(pidl, szSrc))
105  {
106  CStringW strTitle;
107  strTitle.Format(IDS_SHORTCUT, PathFindFileNameW(szSrc));
108 
109  PathAppendW(szDest, strTitle);
110  PathRemoveExtensionW(szDest);
111  StringCbCatW(szDest, sizeof(szDest), L".lnk");
112 
113  hr = CreateShellLink(szDest, szSrc, NULL, NULL, NULL, NULL, -1, NULL);
114  }
115  else
116  {
117  STRRET strret;
118  hr = pDesktop->GetDisplayNameOf(pidl, SHGDN_INFOLDER, &strret);
119  if (FAILED_UNEXPECTEDLY(hr))
120  break;
121 
122  hr = StrRetToBufW(&strret, pidl, szSrc, _countof(szSrc));
123  if (FAILED_UNEXPECTEDLY(hr))
124  break;
125 
126  CStringW strTitle;
127  strTitle.Format(IDS_SHORTCUT, szSrc);
128 
129  PathAppendW(szDest, strTitle);
130  PathRemoveExtensionW(szDest);
131  StringCbCatW(szDest, sizeof(szDest), L".lnk");
132 
133  hr = CreateShellLink(szDest, NULL, pidl, NULL, NULL, NULL, -1, NULL);
134  }
135 
136  if (FAILED_UNEXPECTEDLY(hr))
137  break;
138  }
139 
140  GlobalUnlock(medium.hGlobal);
141  ReleaseStgMedium(&medium);
142 
143  return hr;
144 }
#define CFSTR_SHELLIDLIST
Definition: shlobj.h:469
HRESULT hr
Definition: shlfolder.c:183
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
#define _countof(array)
Definition: fontsub.cpp:30
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1280
const char * fmt
Definition: wsprintf.c:30
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:668
#define IDS_SHORTCUT
Definition: resource.h:12
#define E_FAIL
Definition: ddrawi.h:102
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:121
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 char * LPBYTE
Definition: typedefs.h:52
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:818
smooth NULL
Definition: ftsmooth.c:416
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:26
UINT cidl
Definition: shlobj.h:491
static const WCHAR L[]
Definition: oid.c:1250
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
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:56
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2574
UINT aoffset[1]
Definition: shlobj.h:492
unsigned int UINT
Definition: ndis.h:50
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2018
#define E_POINTER
Definition: winerror.h:2365
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
Definition: dsound.c:943
Definition: shlobj.h:490

◆ GetClassID()

STDMETHODIMP CDeskLinkDropHandler::GetClassID ( CLSID lpClassId)

Implements IPersist.

Definition at line 177 of file CDeskLinkDropHandler.cpp.

178 {
179  TRACE("(%p)\n", this);
180 
181  if (!lpClassId)
182  {
183  ERR("lpClassId is NULL\n");
184  return E_POINTER;
185  }
186 
187  *lpClassId = CLSID_DeskLinkDropHandler;
188 
189  return S_OK;
190 }
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ GetCurFile()

STDMETHODIMP CDeskLinkDropHandler::GetCurFile ( LPOLESTR ppszFileName)

Implements IPersistFile.

Definition at line 147 of file CDeskLinkDropHandler.cpp.

148 {
149  FIXME("(%p)\n", this);
150  return E_NOTIMPL;
151 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IsDirty()

STDMETHODIMP CDeskLinkDropHandler::IsDirty ( void  )

Implements IPersistFile.

Definition at line 153 of file CDeskLinkDropHandler.cpp.

154 {
155  FIXME("(%p)\n", this);
156  return E_NOTIMPL;
157 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Load()

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

Implements IPersistFile.

Definition at line 159 of file CDeskLinkDropHandler.cpp.

160 {
161  return S_OK;
162 }
#define S_OK
Definition: intsafe.h:59

◆ Save()

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

Implements IPersistFile.

Definition at line 164 of file CDeskLinkDropHandler.cpp.

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

◆ SaveCompleted()

STDMETHODIMP CDeskLinkDropHandler::SaveCompleted ( LPCOLESTR  pszFileName)

Implements IPersistFile.

Definition at line 170 of file CDeskLinkDropHandler.cpp.

171 {
172  FIXME("(%p)\n", this);
173  return E_NOTIMPL;
174 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

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