ReactOS 0.4.16-dev-197-g92996da
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{
15public:
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};
#define CF_HDROP
Definition: constants.h:410
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
implementation of IDropTarget interface
Definition: dragdropimpl.h:169
virtual HRESULT STDMETHODCALLTYPE DragLeave()
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
OLE drop target for tree controls.
virtual bool OnDrop(FORMATETC *pFmtEtc, STGMEDIUM &medium, DWORD *pdwEffect)
virtual HRESULT STDMETHODCALLTYPE DragLeave(void)
TreeDropTarget(HWND hTargetWnd)
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
#define pt(x, y)
Definition: drawing.c:79
unsigned long DWORD
Definition: ntddk_ex.h:95
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
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931
unsigned int UINT
Definition: ndis.h:50
#define TVHT_ONITEM
Definition: commctrl.h:3532
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3518
#define TreeView_SelectDropTarget(hwnd, hitem)
Definition: commctrl.h:3487
#define __RPC_FAR
Definition: rpc.h:56
#define DragQueryFile
Definition: shellapi.h:686
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
char TCHAR
Definition: xmlstorage.h:189