Article View: comp.os.ms-windows.programmer.misc
Article #1968Re: drag & drop server
From: Stephen Groundwater
Date: Thu, 17 Dec 1992 01:06
Date: Thu, 17 Dec 1992 01:06
71 lines
3379 bytes
3379 bytes
In a previous article, chris.snell@canrem.com ("chris snell") says:
>Can anyone tell me how to implement a drag & drop SERVER for Win3.1?
>
>What I have so far:
>1/ capture mouse
>2/ get point where user released button
>3/ get parent window with WindowFromPoint(drop_point)
>4/ test ws_ex_AccetpFiles style for dest window, if set then proceed
>5/ ??? get a handle to the ??? dropped filenames structure ???
>6/ post the wm_DropFiles message to the destination window
>
>My problem is step 5. How do I get a handle to the drop point & drop file
>list that is passed in the wm_DropFiles message? Both the DragQueryPoint
>and DragQueryFiles functions use this handle. If it is just a handle to a
>shareable memory block then what is the record structure of that block?
>
>I program in Turbo Pascal For Windows, but I can likely understand
>examples in C if you must (been a coupla years since I wrote C, but I
>can still puzzle it out).
>
>My email address I believe is chris.snell@canrem.com. I will compile and
>post a result back to this conference.
>
>Thanks in advance. Chris.
>
This is the result of my dumping the hDrop memory that
comes on the WM_DROPFILES message, and my understanding of it.
The hDrop memory is a global memory object.
The drag-drop memory object consists of two parts, a header, and
a trailing bit.
The header is 8 bytes long in windows 3.1.
The trailer is however long it needs to be.
The header:
typedef struct tagDragHeader {
UNIT wStructSize; /* Size of struct (8 bytes in this ver) */
UINT x; /* x co-ord on window that is dropped on. (Client DC) */
UINT y; /* y co-ord on window that is dropped on. (Client DC) */
WORD wReserved; /* no known purpose, should be 0 */
} DragHeader;
This is what I think the header structure is, the first three
fields I am more or less sure of, the fourth field is a mystery
to me, but in every drop I've seen it's been 0.
The trailer:
The trailer is a series of null-terminated strings that contain
the strings that DragQueryFile() will return. The number of the
strings is not in any structure, so you don't need to worry about
that.
Example hDrop.
08 00 14 00 13 00 00 00 43 3a 5c 44 4f 53 00 43 ........C:\DOS.C
3a 5c 57 49 4e 44 4f 57 53 00 43 3a 5c 41 55 54 :\WINDOWS.C:\AUT
4f 45 58 45 43 2e 42 41 54 00 00 OEXEC.BAT..
I don't know how many trailing NULLs to put on as GlobalSize return's
a value that is always mod 32, so I put on 2, in file manager, the rest
of the block is filled with NULLs up to its mod 32 size.
This is a drop at 20,19 of the directories C:\DOS and C:\WINDOWS, and the
file AUTOEXEC.BAT .
You should GlobalAlloc a block big enough for the header, and following
file names, and use the flag GMEM_DDESHARE when allocating.
Technical Details
Message-ID:
<1gojquINNqbv@usenet.INS.CWRU.Edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!cleveland.Freenet.Edu!bu254References:
<1992Dec13.3151.2724@dosgate>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!cleveland.Freenet.Edu!bu254 From: bu254@cleveland.Freenet.Edu (Stephen Groundwater) Newsgroups: comp.os.ms-windows.programmer.misc Subject: Re: drag & drop server Date: 17 Dec 1992 01:06:38 GMT Organization: Case Western Reserve University, Cleveland, OH (USA) Lines: 73 Message-ID: <1gojquINNqbv@usenet.INS.CWRU.Edu> References: <1992Dec13.3151.2724@dosgate> Reply-To: bu254@cleveland.Freenet.Edu (Stephen Groundwater) NNTP-Posting-Host: hela.ins.cwru.edu