|
-
Jul 26th, 2002, 08:27 AM
#1
Thread Starter
New Member
Dropfiles emulation
Hi all.
I'm implementing some IPC mechanisms in VB using the API functions.
I'm using SendMessage / PostMessage.
I've been able to perform a data post from my app using WM_COPYDATA (very useful to control Winamp playlist, for example).
Now, I'm trying to emulate a file drag&drop and I'll use WM_DROPFILES. I can't find information on how to create the struct needed to build the message in VB.
Any example available?
Thanks.
-
Jul 26th, 2002, 01:42 PM
#2
-
Jul 26th, 2002, 03:25 PM
#3
Thread Starter
New Member
Not really...
Thank you, Hack, but I was refering to another issue...
In the case that you suggest, the drag&drop operation is manual (it's performed by the user), and the way to handle the dropped file info is explained in the MSDN lib.
What I want to do is emulate the drag&drop operation from my application, i.e. creating the struct containing the filelist to be passed and sending it to the destination application using a SendMessage(,,WM_DROPFILES...
This can be very useful to control some applications from my app. For example, I will be able to pass an entire playlist to the Winamp Playlist window in a single message.
Thanks again.
Alex
___________
-
Jul 29th, 2002, 11:38 AM
#4
Hyperactive Member
Here I go...
Alright, I have never before worked with WM_DROPFILES, but Hack's link was actually very helpful for using as a stepping stone. I started working the problem backward: if you know how to handle the situation, then if you know what caused the situation, you can emulate it. Basically I monitored Notepad with spy++ to watch for the WM_DROPFILES message. The wParam contains the hDrop value when sending the WM_DROPFILES message. This is incredibly important because I believe it is a pointer to the structure that contains information about the drag operation. Although I am not entirely sure, I am almost positive that hDrop should be a pointer to a DRAGINFO structure. This structure, when configured with the proper values should appropriately simulate the drag and drop operation if you pass the pointer to it in wParam. That is my thesis; I have not been able to test it, nor will I have time in the near future to do so. Here is the structure from the API viewer:
VB Code:
Public Type DRAGINFO
uSize As Long ' init with sizeof(DRAGINFO)
pt As POINTAPI
fNC As Long
lpFileList As String
grfKeyState As Long
End Type
I do not think this structure is enough to simulate it though because I found this c++ definition of the structure:
Code:
typedef struct _DRAGINFO
{
ULONG cbDraginfo; // Structure size
USHORT cbDragitem; // DRAGITEM structures sizes
USHORT usOperation; // Modified drag operations
HWND hwndSource; // Window handle
SHORT xDrop; // X-coordinate
SHORT yDrop; // Y-coordinate
USHORT cditem; // Count of DRAGITEM structures
USHORT usReserved; // Reserved
} DRAGINFO;
This may be the defintion that yields the best success, but I am still undecided about which method I would try first if I had time. I wish you luck, and if you find out how to do it, please post it. (My recommendation for this situation and in general is to not immediately discount any information dealing with your topic. In this situation, I would recommend working it backward, especially when you have to assign which file names you are moving. Because of the article posted by Hack, it is very likely that to store the filenames in the lpFileList you store exactly 128 characters for each filename. That is just a guess, but it may help you. Good luck again)
Joe
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|