This technique is for use with Liberty BASIC 3.
These functions are part of shell32.dll. They are used in the drag 'n' drop examples explained by Mitchel Kotler later in the newsletter. This technique is for more experienced Liberty BASIC programmers. It requires a thorough knowledge of API calling in LB. It also requires the wmliberty.dll, which requires callbacks.
calldll #shell32, "DragAcceptFiles",_ hWnd as long,_ 'handle to the registering window fAccept as boolean, 'acceptance option ret as void
The DragAcceptFiles function registers whether a window accepts dropped files.
Identifies the window registering whether it accepts dropped files.
Specifies whether the window identified by the hWnd parameter accepts dropped files. This value is TRUE to accept dropped files; it is FALSE to discontinue accepting dropped files. (Editor's note: In the examples by Mitch, this parameter is passed as a short. It should be passed as boolean.)
This function does not return a value.
An application that calls DragAcceptFiles with the fAccept parameter set to TRUE has identified itself as able to process the WM_DROPFILES message from File Manager.
calldll #shell32, "DragQueryFileA",_ hDrop as long,_ 'handle to structure for dropped files iFile as ulong,_ 'index of file to query lpszFile$ as ptr,_ 'buffer for returned filename cch as ulong,_ 'size of buffer for filename ret as ulong
The DragQueryFile function retrieves the filenames of dropped files.
Identifies the structure containing the filenames of the dropped files.
Specifies the index of the file to query. If the value of the iFile parameter is 0xFFFFFFFF, DragQueryFile returns a count of the files dropped. If the value of the iFile parameter is between zero and the total number of files dropped, DragQueryFile copies the filename with the corresponding value to the buffer pointed to by the lpszFile parameter.
Points to a buffer to receive the filename of a dropped file when the function returns. This filename is a null-terminated string. If this parameter is NULL, DragQueryFile returns the required size, in characters, of the buffer.
Specifies the size, in characters, of the lpszFile buffer.
When the function copies a filename to the buffer, the return value is a count of the characters copied, not including the terminating null character. If the index value is 0xFFFFFFFF, the return value is a count of the dropped files. If the index value is between zero and the total number of dropped files and the lpszFile$ buffer address is NULL, the return value is the required size, in characters, of the buffer, not including the terminating null character.
struct point, x as long, y as long
calldll #shell32, "DragQueryPoint",_ hDrop as long,_ 'handle to structure for dropped file point as struct,_ 'pointer to structure for mouse coordinates result as boolean
The DragQueryPoint function retrieves the position of the mouse pointer at the time a file was dropped.
Identifies the structure describing the dropped file.
Points to a POINT structure that the function fills with
the coordinates of the mouse pointer at the time the
file was dropped.
If the drop occurred in the client area of the window, the return value is nonzero. If the drop did not occur in the client area of the window, the return value is zero. (Editor's note: in Mitch's example, this is improperly passed as a ulong. It should be a boolean.)
The DragQueryPoint function fills the POINT structure with the coordinates of the mouse pointer at the time the user released the left mouse button. The window for which coordinates are returned is the window that received the WM_DROPFILES message. In LB3, this is provided by the wmliberty.dll.
calldll #shell32, "DragFinish",_ hDrop as long,_ 'handle to memory to free result as void
The DragFinish function releases memory that Windows allocated for use in transferring filenames to the application.
Identifies the structure describing dropped files. This handle is retrieved from the wParam parameter of the WM_DROPFILES message. In LB, this is furnished by the wmliberty.dll.
This function does not return a value.