ReactOS  0.4.12-dev-75-g00dd17e
DesktopDropTarget Class Reference

OLE drop target for the desktop window. More...

#include <desktop.h>

Inheritance diagram for DesktopDropTarget:
Collaboration diagram for DesktopDropTarget:

Public Member Functions

 DesktopDropTarget (HWND hTargetWnd)
 
virtual bool OnDrop (FORMATETC *pFmtEtc, STGMEDIUM &medium, DWORD *pdwEffect)
 
virtual HRESULT STDMETHODCALLTYPE DragOver (DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
 
virtual HRESULT STDMETHODCALLTYPE DragLeave (void)
 
- Public Member Functions inherited from IDropTargetImpl
 IDropTargetImpl (HWND m_hTargetWnd)
 
virtual ~IDropTargetImpl ()
 
void AddSuportedFormat (FORMATETC &ftetc)
 
virtual HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
 
virtual ULONG STDMETHODCALLTYPE AddRef ()
 
virtual ULONG STDMETHODCALLTYPE Release ()
 
bool QueryDrop (DWORD grfKeyState, LPDWORD pdwEffect)
 
virtual HRESULT STDMETHODCALLTYPE DragEnter (IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
 
virtual HRESULT STDMETHODCALLTYPE Drop (IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
 
- Public Member Functions inherited from IDropTarget
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 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)
 

Private Types

typedef IDropTargetImpl super
 

Additional Inherited Members

- Public Types inherited from IDropTarget
typedef IDropTargetLPDROPTARGET
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- 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
 
- Protected Attributes inherited from IDropTargetImpl
HWND m_hTargetWnd
 

Detailed Description

OLE drop target for the desktop window.

Definition at line 95 of file desktop.h.

Member Typedef Documentation

◆ super

Definition at line 97 of file desktop.h.

Constructor & Destructor Documentation

◆ DesktopDropTarget()

DesktopDropTarget::DesktopDropTarget ( HWND  hTargetWnd)
inline

Definition at line 100 of file desktop.h.

100 : super(hTargetWnd) {}
IDropTargetImpl super
Definition: desktop.h:97

Member Function Documentation

◆ DragLeave()

virtual HRESULT STDMETHODCALLTYPE DesktopDropTarget::DragLeave ( void  )
inlinevirtual

Reimplemented from IDropTargetImpl.

Definition at line 159 of file desktop.h.

160  {
161  //@@ TreeView_SelectDropTarget(m_hTargetWnd, NULL);
162 
163  return super::DragLeave();
164  }
virtual HRESULT STDMETHODCALLTYPE DragLeave()

◆ DragOver()

virtual HRESULT STDMETHODCALLTYPE DesktopDropTarget::DragOver ( DWORD  grfKeyState,
POINTL  pt,
DWORD __RPC_FAR pdwEffect 
)
inlinevirtual

Reimplemented from IDropTargetImpl.

Definition at line 138 of file desktop.h.

142  {
143  TVHITTESTINFO hit;
144  hit.pt.x = pt.x;
145  hit.pt.y = pt.y;
147  hit.flags = TVHT_ONITEM;
148 
149  /*@@
150  HTREEITEM hItem = TreeView_HitTest(m_hTargetWnd,&hit);
151 
152  if (hItem != NULL)
153  TreeView_SelectDropTarget(m_hTargetWnd, hItem);
154  */
155 
156  return super::DragOver(grfKeyState, pt, pdwEffect);
157  }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG y
Definition: windef.h:320
LONG x
Definition: windef.h:319
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define TVHT_ONITEM
Definition: commctrl.h:3494

◆ OnDrop()

virtual bool DesktopDropTarget::OnDrop ( FORMATETC *  pFmtEtc,
STGMEDIUM &  medium,
DWORD pdwEffect 
)
inlinevirtual
Todo:
Add the code to handle Copy
Todo:
Add the code to handle Move

Implements IDropTargetImpl.

Definition at line 102 of file desktop.h.

103  {
104  if (pFmtEtc->cfFormat==CF_HDROP && medium.tymed==TYMED_HGLOBAL) {
105  HDROP hDrop = (HDROP)GlobalLock(medium.hGlobal);
106 
107  if (hDrop) {
108  TCHAR szFileName[MAX_PATH];
109 
110  UINT cFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
111 
112  for(UINT i=0; i<cFiles; ++i) {
113  DragQueryFile(hDrop, i, szFileName, sizeof(szFileName) / sizeof(szFileName[0]));
114 
115  if (DROPEFFECT_COPY & *pdwEffect) {
116  // copy the file or dir
117 
119 
120  } else if (DROPEFFECT_MOVE & *pdwEffect) {
121  // move the file or dir
122 
124 
125  }
126  }
127  //DragFinish(hDrop); // base class calls ReleaseStgMedium
128  }
129 
130  GlobalUnlock(medium.hGlobal);
131  }
132 
133  //@@TreeView_SelectDropTarget(m_hTargetWnd, NULL);
134 
135  return true; //let base free the medium
136  }
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:416
#define CF_HDROP
Definition: constants.h:410
char TCHAR
Definition: xmlstorage.h:189
#define MAX_PATH
Definition: compat.h:26
unsigned int UINT
Definition: ndis.h:50
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define DragQueryFile
Definition: shellapi.h:672

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