Solved

IDataObject : Getting file names

Posted on 1998-11-08
2
295 Views
Last Modified: 2013-11-20
I implemented an IDropTarget object, So my object will be
able to handle drop of files. The user drags files into
that object.

As you all probably know, The ::Drop method of that object
gets a pointer to IDataObject as parameter.

I'm looking for a code that gets the names of the files that
were dragged into my IDropTarget object, from that horrible
"IDropTarget" object.

0
Comment
Question by:motigust
2 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 200 total points
ID: 1324371
Here's a sample drop method to help you out...

STDMETHODIMP SampleType::Drop (IDataObject *pDataObj,
DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
{
HRESULT hres = E_FAIL;
FORMATETC fmte = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
STGMEDIUM medium;

if (pDataObj && SUCCEEDED (pDataObj->GetData (&fmte, &medium)))
{
char szFileDropped [MAX_PATH];

DragQueryFile ((HDROP)medium.hGlobal, 0, szFileDropped,
sizeof (szFileDropped));
TRACE ("SampleType::Drop(%s,%s)", this->szFileName, szFileDropped);
hres = S_OK;

if (medium.pUnkForRelease)
medium.pUnkForRelease->Release ();
else
GlobalFree (medium.hGlobal);
}

return hres;
}

Cheers,

Raymond.

0
 
LVL 1

Author Comment

by:motigust
ID: 1324372
Good work Raymond!
Thanks.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question