开发者

Drag Drop using SendMessage

开发者 https://www.devze.com 2022-12-16 06:35 出处:网络
This sounds funny..just a little experiment. i wanted to simulate a drag drop of a file on a Application/Window using Send Message.

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 t开发者_如何转开发he .exe which will do drag drop from code.

**Note: IP Messenger supports drag-drop operation for files

thx

amit


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消