Drag Drop using SendMessage
c#, c++, drag-and-drop, sendmessage, winapi
Solution
There is the `WM_DROPFILES` Message. I guess that you could use `CreateToolhelp32Snapshot` to locate the window that is IP Messenger and then build the `DROPFILES` structure to send with the `WM_DROPFILES` message.
The final link would be to Codeproject, with some help on creating the `DROPFILES` structure: How to Implement Drag and Drop Between Your Program and Explorer.
Instead of using `CreatToolhelp32Snapshot` you could be using `FindWindow` function. Here you will get the `HWND` for IP Messenger directly, instead of `CTh32S`, which will only locate the `HANDLE` for the process.
When this is done you create the `DROPFILES` structure. Read the comments on the CodeProject link in the "Initiating a drag and drop" section for more info of how.
And finally you send it with sendmessage
SendMessage(ipMessHWND, WM_DROPFILES, (HDROP)&myDropFiles, 0);
Problem
This sounds funny..just a little experiment. i wanted to simulate a drag drop of a file on a Application/Window using Send Message. Is it possible? I dont have code for the application but on the executable. The application is IP Messenger. What i wanted to do is use "Send To" functionality to send the file to an .exe ,which will find IPMessenger window and simulate a drag drop thr code. The user will select the file and right click "send to" to the .exe which will do drag drop from code. **Note: IP Messenger supports drag-drop operation for files thx amit