WM_DROPFILES to desktop.

Is it possible to send data to the desktop from my application with WM_DROPFILES? How would an example look like?

Your sincerely andla.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Yes, it is possible and quite easy:

1) Use ::GetDesktopWindow() to get the HWND to the desktop window.

2) Use ::SendMessage() to send the WM_DROPFILES message to that window.
The syntax is:

::SendMessage(hWnd, WM_DROPFILES, (WPARAM)&hDrop, 0);

3) hDrop is a pointer to an HDROP struct

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andlaAuthor Commented:
How do i make the data move as a file where the mouse pointer is dropped in explorer ?
I may have misunderstood your question.  

If you want to have your application support graphically dragging things out of it to the desktop, you need to use the IDropSource COM interface and the DoDragDrop function.
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

andlaAuthor Commented:
I was thinking of creating files from my application. I don't know where to look how the HDROP structure looks like but i dont think there is a member that store the actual data. I know that it is possible to assign a path to a file that the application makes temporarily. But i'm not sure if this works.
  Like the winzip tool it extracts file to a temp directory i was thinking of the same thing.

I must say that i'm thinking of other alernative than using ole drag and drop because it seems inpossible to RegisterDragDrop(...) a hwnd to a listbox. I'm using ATL and don't want MFC because it will increase the size of the control.

andlaAuthor Commented:
Just as we send comments i found out how to use the ole drag drop in a listbox. I must be to clever...naa.
andlaAuthor Commented:
Please help me out while i examine my other problem with ole drag drop.?

Your sincerely
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.