ReactOS  0.4.14-dev-115-g4576127
treedroptarget.h
Go to the documentation of this file.
1 /**************************************************************************
2  THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF
3  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
4  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
5  PARTICULAR PURPOSE.
6  Author: Leon Finker 01/2001
7  Modifications: removed ATL dependencies, Martin Fuchs 7/2003
8 **************************************************************************/
9 
10 #include "dragdropimpl.h"
11 
14 {
15 public:
16  TreeDropTarget(HWND hTargetWnd) : IDropTargetImpl(hTargetWnd) {}
17 
18  virtual bool OnDrop(FORMATETC* pFmtEtc, STGMEDIUM& medium, DWORD *pdwEffect)
19  {
20  if (pFmtEtc->cfFormat == CF_HDROP && medium.tymed == TYMED_HGLOBAL)
21  {
22  HDROP hDrop = (HDROP)GlobalLock(medium.hGlobal);
23  if (hDrop != NULL)
24  {
25  TCHAR szFileName[MAX_PATH];
26 
27  UINT cFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
28 
29  for(UINT i = 0; i < cFiles; ++i)
30  {
31  DragQueryFile(hDrop, i, szFileName, sizeof(szFileName));
32 
33  if (DROPEFFECT_COPY & *pdwEffect)
34  {
35  // copy the file or dir
36 
38 
39  }
40  else if (DROPEFFECT_MOVE & *pdwEffect)
41  {
42  // move the file or dir
43 
45 
46  }
47  }
48  //DragFinish(hDrop); // base class calls ReleaseStgMedium
49  }
50  GlobalUnlock(medium.hGlobal);
51  }
52 
54 
55  return true; //let base free the medium
56  }
57 
59  /* [in] */ DWORD grfKeyState,
60  /* [in] */ POINTL pt,
61  /* [out][in] */ DWORD __RPC_FAR *pdwEffect)
62  {
63  TVHITTESTINFO hit;
64  hit.pt.x = pt.x;
65  hit.pt.y = pt.y;
67  hit.flags = TVHT_ONITEM;
69 
70  if (hItem != NULL)
72 
73  return IDropTargetImpl::DragOver(grfKeyState, pt, pdwEffect);
74  }
75 
77  {
79 
81  }
82 };
long y
Definition: polytest.cpp:48
virtual HRESULT STDMETHODCALLTYPE DragLeave(void)
long x
Definition: polytest.cpp:48
#define pt(x, y)
Definition: drawing.c:79
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
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
smooth NULL
Definition: ftsmooth.c:416
#define CF_HDROP
Definition: constants.h:410
#define TreeView_SelectDropTarget(hwnd, hitem)
Definition: commctrl.h:3454
#define __RPC_FAR
Definition: rpc.h:56
OLE drop target for tree controls.
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
char TCHAR
Definition: xmlstorage.h:189
virtual bool OnDrop(FORMATETC *pFmtEtc, STGMEDIUM &medium, DWORD *pdwEffect)
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3485
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
virtual HRESULT STDMETHODCALLTYPE DragLeave()
unsigned long DWORD
Definition: ntddk_ex.h:95
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
implementation of IDropTarget interface
Definition: dragdropimpl.h:168
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931
unsigned int UINT
Definition: ndis.h:50
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define DragQueryFile
Definition: shellapi.h:682
TreeDropTarget(HWND hTargetWnd)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define TVHT_ONITEM
Definition: commctrl.h:3499