OLE drop target for tree controls. More...
#include <treedroptarget.h>


Public Member Functions | |
| TreeDropTarget (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) |
OLE drop target for tree controls.
Definition at line 13 of file treedroptarget.h.
| TreeDropTarget::TreeDropTarget | ( | HWND | hTargetWnd ) | [inline] |
Definition at line 16 of file treedroptarget.h.
: IDropTargetImpl(hTargetWnd) {}
| virtual HRESULT STDMETHODCALLTYPE TreeDropTarget::DragLeave | ( | void | ) | [inline, virtual] |
Reimplemented from IDropTargetImpl.
Definition at line 75 of file treedroptarget.h.
References IDropTargetImpl::m_hTargetWnd.
{
TreeView_SelectDropTarget(m_hTargetWnd, NULL);
return IDropTargetImpl::DragLeave();
}
| virtual HRESULT STDMETHODCALLTYPE TreeDropTarget::DragOver | ( | DWORD | grfKeyState, |
| POINTL | pt, | ||
| DWORD __RPC_FAR * | pdwEffect | ||
| ) | [inline, virtual] |
Reimplemented from IDropTargetImpl.
Definition at line 58 of file treedroptarget.h.
References IDropTargetImpl::m_hTargetWnd, and ScreenToClient().
{
TVHITTESTINFO hit;
hit.pt = (POINT&)pt;
ScreenToClient(m_hTargetWnd, &hit.pt);
hit.flags = TVHT_ONITEM;
HTREEITEM hItem = TreeView_HitTest(m_hTargetWnd,&hit);
if (hItem != NULL)
TreeView_SelectDropTarget(m_hTargetWnd, hItem);
return IDropTargetImpl::DragOver(grfKeyState, pt, pdwEffect);
}

| virtual bool TreeDropTarget::OnDrop | ( | FORMATETC * | pFmtEtc, |
| STGMEDIUM & | medium, | ||
| DWORD * | pdwEffect | ||
| ) | [inline, virtual] |
Implements IDropTargetImpl.
Definition at line 18 of file treedroptarget.h.
References IDropTargetImpl::m_hTargetWnd.
{
if (pFmtEtc->cfFormat == CF_HDROP && medium.tymed == TYMED_HGLOBAL)
{
HDROP hDrop = (HDROP)GlobalLock(medium.hGlobal);
if (hDrop != NULL)
{
TCHAR szFileName[MAX_PATH];
UINT cFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
for(UINT i = 0; i < cFiles; ++i)
{
DragQueryFile(hDrop, i, szFileName, sizeof(szFileName));
if (DROPEFFECT_COPY & *pdwEffect)
{
// copy the file or dir
///@todo Add the code to handle Copy
}
else if (DROPEFFECT_MOVE & *pdwEffect)
{
// move the file or dir
///@todo Add the code to handle Move
}
}
//DragFinish(hDrop); // base class calls ReleaseStgMedium
}
GlobalUnlock(medium.hGlobal);
}
TreeView_SelectDropTarget(m_hTargetWnd, NULL);
return true; //let base free the medium
}
|
ROS Explorer Source Code Documentation
generated on 02.01.2013 by
|