Public Member Functions

DesktopDropTarget Class Reference

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

#include <desktop.h>

Inheritance diagram for DesktopDropTarget:
Inheritance graph
[legend]
Collaboration diagram for DesktopDropTarget:
Collaboration graph
[legend]

List of all members.

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)

Detailed Description

OLE drop target for the desktop window.

Definition at line 95 of file desktop.h.


Constructor & Destructor Documentation

DesktopDropTarget::DesktopDropTarget ( HWND  hTargetWnd ) [inline]

Definition at line 100 of file desktop.h.

: super(hTargetWnd) {}

Member Function Documentation

virtual HRESULT STDMETHODCALLTYPE DesktopDropTarget::DragLeave ( void   ) [inline, virtual]

Reimplemented from IDropTargetImpl.

Definition at line 158 of file desktop.h.

References IDropTargetImpl::DragLeave().

    {
        //@@ TreeView_SelectDropTarget(m_hTargetWnd, NULL);

        return super::DragLeave();
    }

Here is the call graph for this function:

virtual HRESULT STDMETHODCALLTYPE DesktopDropTarget::DragOver ( DWORD  grfKeyState,
POINTL  pt,
DWORD __RPC_FAR *  pdwEffect 
) [inline, virtual]

Reimplemented from IDropTargetImpl.

Definition at line 138 of file desktop.h.

References IDropTargetImpl::DragOver(), 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 super::DragOver(grfKeyState, pt, pdwEffect);
    }

Here is the call graph for this function:

virtual bool DesktopDropTarget::OnDrop ( FORMATETC *  pFmtEtc,
STGMEDIUM &  medium,
DWORD *  pdwEffect 
) [inline, virtual]

Todo:
Add the code to handle Copy
Todo:
Add the code to handle Move

Implements IDropTargetImpl.

Definition at line 102 of file desktop.h.

    {
        if (pFmtEtc->cfFormat==CF_HDROP && medium.tymed==TYMED_HGLOBAL) {
            HDROP hDrop = (HDROP)GlobalLock(medium.hGlobal);

            if (hDrop) {
                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
    }

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

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage