Shell Functions


DragQueryFile Function

Retrieves the names of dropped files that result from a successful drag-and-drop operation.

Syntax

UINT DragQueryFile(      
    HDROP hDrop,     UINT iFile,     LPTSTR lpszFile,     UINT cch );

Parameters

hDrop
[in] Identifier of the structure that contains the file names of the dropped files.
iFile
[in] Index of the file to query. If the value of this parameter is 0xFFFFFFFF, DragQueryFile returns a count of the files dropped. If the value of this parameter is between zero and the total number of files dropped, DragQueryFile copies the file name with the corresponding value to the buffer pointed to by the lpszFile parameter.
lpszFile
[out] The address of a buffer that receives the file name of a dropped file when the function returns. This file name is a null-terminated string. If this parameter is NULL, DragQueryFile returns the required size, in characters, of this buffer.
cch
The size, in characters, of the lpszFile buffer.

Return Value

A non-zero value indicates a successful call.

When the function copies a file name 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. Note that the index variable itself returns unchanged, and therefore remains 0xFFFFFFFF.

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.

Windows 95/98/Me: DragQueryFile is supported by the Microsoft Layer for Unicode (MSLU). To use MSLU, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows Me/98/95 Systems.

Function Information

Minimum DLL Versionshell32.dll version 4.0 or later
Custom ImplementationNo
Headershellapi.h
Import libraryshell32.lib
Minimum operating systems Windows NT 3.1, Windows 95
UnicodeImplemented as ANSI and Unicode versions.

See Also

DragQueryPoint
Tags :


Community Content

dmex
vb.net syntax
<DllImport("shell32.dll", CharSet:=CharSet.Auto)> Public Shared Function DragQueryFile(ByVal hDrop As HandleRef, ByVal iFile As Integer, ByVal lpszFile As StringBuilder, ByVal cch As Integer) As Integer
End Function
Tags :

dmex
C# syntax
[DllImport("shell32.dll", CharSet=CharSet.Auto)]
public static extern int DragQueryFile(HandleRef hDrop, int iFile, StringBuilder lpszFile, int cch);
Tags :

Page view tracker