Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

IDataObject : Getting file names

Posted on 1998-11-08
2
Medium Priority
?
396 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 800 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

926 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