[comp.windows.ms.programmer] Drag & Drop with the file manager

green@vis.toronto.edu (Anthony Thomas Green) (12/12/90)

Recently, somebody posted some undocumented message numbers for drag and
drop functions.
I realize that they'll probably change for WIN3.1, but I wanted to give
them a go anyway.
 
I created a window, and put case statements in the window function for
	WM_QUERYDROPOBJECT (0x22B)
   and  WM_DROPOBJECT (0x22A)
 
When I dragged a file icon from the the file manager over to my window, 
I got a WM_QUERYDROPOBJECT message. Happy about this, I changed the
code to return TRUE when I got this message.
Sure enough; when I dragged the crossed "O" icon (indicating it can't
be dropped) over to my window - it reverted to it's original shape!
Oh happy day!
 
The next challange was to get the file name represented by the icon I
picked up. 
When I drop the icon on my window I get a WM_DROPOBJECT message. Good.
wParam happens to be the window handle of the directory window I picked
the icon up from (this was discovered after poking about with SPY).
LOWORD(lParam) is always 0x0000. HIWORD(lParam) changes.
 
My first guess was that the file manager stores the file name as a
global atom and that HIWORD(lParam) is it's handle. So I added
 
           char cBuffer[256];
           WORD wBytes;
 
           case 0x022A: /* WM_DROPOBJECT */
               wBytes = GlobalGetAtomName(HIWORD(lParam), cBuffer, 255);
               break;
 
I looked at the result with CodeView and got
 
           wBytes == 5
           cBuffer == "#3717"
 
Well, I was hoping for a file name, but I think this is encouraging,
since GlobalGetAtomName returns 0 when passed and invalid global atom.
In this case HIWORD(lParam) == 0xE85, which happens to be 3717! (Look at
cBuffer again).
 
What's going on? Maybe the file manager is storing the file name in
a property list. So I tried GetProp(wParam, cBuffer), but to no avail.
It returned 0.
 
Does anybody have more information and/or ideas?
 
Anthony Green
green@ai.toronto.edu