DragQueryFile

3.1

  #include <shellapi.h>    

  UINT DragQueryFile(hDrop, iFile, lpszFile, cb)    
  HDROP hDrop; /* handle of structure for dropped files */
  UINT iFile; /* index of file to query */
  LPSTR lpszFile; /* address of buffer for returned filename */
  UINT cb; /* size of buffer for filename */

The DragQueryFile function retrieves the number of dropped files and their filenames.

Parameters

hDrop

Identifies the internal data structure containing filenames for the dropped files. This handle is passed to the application in the wParam parameter of the WM_DROPFILES message.

iFile

Specifies the index of the file to query. The index of the first file is 0. If the value of the iFile parameter is –1, DragQueryFile returns the number of files dropped. If the value of the iFile parameter is between zero and the total number of files dropped, DragQueryFile copies the filename corresponding to that value to the buffer pointed to by the lpszFile parameter.

lpszFile

Points to a null-terminated string that contains the filename of a dropped file when the function returns. If this parameter is NULL and the iFile parameter specifies the index for the name of a dropped file, DragQueryFile returns the required size, in bytes, of the buffer for that filename.

cb

Specifies the size, in bytes, of the lpszFile buffer.

Return Value

When the function copies a filename to the lpszFile buffer, the return value is the number of bytes copied. If the iFile parameter is 0xFFFF, the return value is the number of dropped files. If iFile is between zero and the total number of dropped files and if lpszFile is NULL, the return value is the required size of the lpszFile buffer.

See Also

DragQueryPoint