Accepting drag and drop from File Manager
File Manager supports dragging files, and some applications support dropping them. Try dragging a file from File Manager to Program Manager, and you'll see what I mean. You can do this too; just follow these simple steps. Copy and paste this as DRAGDROP.BAS:
Author:


'THREE EASY STEPS TO BEING A DRAG/DROP CLIENT


'STEP ONE -------------------------------------------

 'Place a message blaster on the form. Set it to
 'catch the WM_DROPFILES standard message for the
 'target control


'STEP TWO -------------------------------------------

 'Register the target control (or form) with Windows
 'as a recipient of drag/drop messages, by calling
 'DragAcceptFiles in the load event of the form
 'containing the target control (or the target form)
 '-- like so:
                                               
'          DragAcceptFiles .hWnd, True


'STEP THREE -----------------------------------------

 'When the message blaster catches the WM_DROPFILES
 'message, use the GetArrayOfDroppedFiles function or
 'the GetListOfDroppedFiles function to gather all
 'the information about the dropped files.
 


Type Type_Point
        X As Integer
        Y As Integer
End Type

Declare Sub DragAcceptFiles Lib "Shell" (ByVal hWnd%, ByVal accept%)
Declare Function DragQueryPoint% Lib "Shell" (ByVal hDrop%, lpPNT As Type_Point)
Declare Function DragQueryFile% Lib "Shell" (ByVal hDrop%, ByVal iFile%, ByVal lpBuff$, ByVal BUFFSIZE%)
Declare Function DragFinish% Lib "Shell" (ByVal hDrop%)

Global Const WM_DROPFILES = 563

Function GetArrayOfDroppedFiles% (hDrop%, sFileArray$(), iX%, iY%, iClient%)

'-----------------------------------------------------------------
'
'   hDrop%      wParam from message blaster.
'
'   sFileArray  A dynamic string array. Will be filled
'               with the names of the dropped files.
'               A string representation of the number
'               of files will be put into array(0), and
'               the file names will start in array(1).
'
'   iX%         An integer. Will be set to the
'               X coordinate of the mouse.
'
'   iY%         An integer. Will be set to the
'               Y coordinate of the mouse.
'
'   iClient%    A boolean that will be set TRUE if the files
'               were dropped in the window's client area.
'
'   The function returns the number of dropped files.
'
'-----------------------------------------------------------------

Dim iCount%, iLen%, iNumFiles%, iDummy%
Const BUFFSIZE% = 256
Dim szBuffer As String * BUFFSIZE
Dim DropXY As Type_Point

    iNumFiles = DragQueryFile(hDrop, -1, szBuffer, BUFFSIZE)
    ReDim sFileArray(0 To iNumFiles - 1)
    
    'fill the array
    For iCount = 0 To iNumFiles - 1
        iLen = DragQueryFile(hDrop, iCount, szBuffer, BUFFSIZE)
        sFileArray(iCount) = Left$(szBuffer, iLen)
    Next
    
    'get drop location
    iClient = DragQueryPoint(hDrop, DropXY)
    iX = DropXY.X
    iY = DropXY.Y

    'release the handle
    iDummy = DragFinish(hDrop)

    GetArrayOfDroppedFiles = iNumFiles

End Function


Function GetListOfDroppedFiles (hDrop%, FileList As ListBox, iX%, iY%,
iClient%)

'-----------------------------------------------------------------
'
'   hDrop%      wParam from message blaster.
'
'   FileList    A listbox. Will be filled with
'               the names of the dropped files.
'
'   iX%         An integer. Will be set to the
'               X coordinate of the mouse.
'
'   iY%         An integer. Will be set to the
'               Y coordinate of the mouse.
'
'   iClient%    A boolean that will be set TRUE if the files
'               were dropped in the window's client area.
'
'   The function returns the number of dropped files.
'
'-----------------------------------------------------------------

Dim iCount%, iLen%, iNumFiles%, iDummy%
Const BUFFSIZE% = 256
Dim szBuffer As String * BUFFSIZE

Dim DropXY As Type_Point

    FileList.Clear

    iNumFiles = DragQueryFile(hDrop, -1, szBuffer, BUFFSIZE)
    
    'fill the list
    For iCount = 0 To iNumFiles - 1
        iLen = DragQueryFile(hDrop, iCount, szBuffer, BUFFSIZE)
        FileList.AddItem Left$(szBuffer, iLen)
    Next
    
    'get drop location
    iClient = DragQueryPoint(hDrop, DropXY)
    iX = DropXY.X
    iY = DropXY.Y

    'free the handle
    iDummy = DragFinish(hDrop)

    GetListOfDroppedFiles = iNumFiles

End Function