Contents of the D&DSERVE.TXT file
DLL to Support Win 3.1 Drag 'n Drop Server Capability
by Jonathan Zuck
Published in the August 1992 Windows Tech Journal
This file contains the description for use by VB programmers
DropSelItems Drops the selected files in a multi-select List Box
DropAllItems Drops all the files in a list box
DropBuff Drops files contained in a passed buffer
Declare Function DropSelItems Lib "D&DSERVE.DLL" (ByVal hList, ByVal Path$, ByVal nButton)
Declare Function DropAllItems Lib "D&DSERVE.DLL" (ByVal hList, ByVal nButton)
Declare Function DropBuff Lib "D&DSERVE.DLL" (ByVal Buff$, ByVal nButton)
You must have a multi-select list box to use this function. Most of
you will be using those list boxes available from third parties such as
Crescent, MicroHelp and Sheridan. However, to make the demo more generalized,
I modified Costas' MultiPik demo to accomodate the needs of a file list.
Unfortunately, this means that it's a little more complicated than it needs
to be. The real demo code for this function would look something like this:
Sub MyFileList_MouseDown (Button As Integer, X As Single, Y as Single)
Path$ = Dir1.Path + "\"
hTarget = DropSelItems (MyFileList.hWnd, Path$, Button)
where hTarget will be the hWnd of the Window on which the selected files
were dropped or Zero if the mouse was not released over a valid window.
One caveat is that the left mouse button will generally remove the
selections from an extended selection list box (the File manage does a
ton of special processing). Therefore, you might want to specify for the
user that the Right mouse button be used to drag from the list box.
This function has two advantages. First, it does not require a
multi-select list box so those of you without add-ons will be able to
use it. Second, it is capabile of dealing with files from multiple
directories which DropSelItems (or even FileManager) is not capable of.
Keep in mind that since you do not pass the path to this funtion, each
file name in the list must be fully qualified. When used, this function
will drop all of the items in the list on the target window.
This function is provided primarily for those programming systems
that are not able to use a standard list box or have special needs. In
this case, you are essentially constructing the buffer that will be sent
to the target window. The format of this buffer is a fully qualified
filename, followed by a null, followed by another filename+NULL, etc., and
finally terminated by another null.
Visual Basic will add the terminating null so you don't need to
worry about the second one. You just need to construct a strong like so:
N$ = Chr$(0)
Buff$ = "C:\AUTOEXEC.BAT" + N$ + "C:\DOS\README.TXT" + N$
and then pass it ByVal to the function. I dont't generally recommend this
function as it is the least intuitive to the user but it might be helpful
under special circumstances.
Testing your Code:
I have found WRITE to be the best place to test these functions
as it is one of the only WINAPPs that supports the dropping of multiple
files (into the client area, *not* on the icon!).
The TPW source code for D&DSERVE is available in Lib 9 of CLMFORUM
and was first published in the August 1992 issue of the Windows Tech
Journal. For explanations of how these functions work, please contact
Oakley Publishing for back issues.
For more information or subscriptions to the Windows Tech Journal,
call (800) 234 - 0386 or outside of the US, (503) 747 - 0800. The fax number
is (503) 747 - 0071. Alternatively, you may reach the editor, J.D. Hildebrand
(until he becomes too popular) here on CIS at id: 76701,32. The journal
can be reached by mail at:
Windows Tech Journal
P.O. Box 70167
Eugene, OR 97401-0110
Thanks a lot for your interest! -=- Jonathan