Solved

IDataObject : Getting file names

Posted on 1998-11-08
2
259 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now