FindFirstFile()

Purpose
The FindFirstFile function searches a directory for a file whose name matches the specified filename. FindFirstFile examines subdirectory names as well as filenames. 
 
Library Transcribed by Date of page Updated on
Kernel32.dll J.Paris 25.06.02  
 
Restrictions on use
none
 
Declare 32-bit

Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA"

    (

       ByVal lpFileName As String,

       lpFindFileData As WIN32_FIND_DATA

     ) As Integer

Required Type definition

WIN32_FIND_DATA

FileTime

 
Parameters

lpFileName

 

 

 

 

lpFindFileData

Points to a null-terminated string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?).
Windows 95 This string must not exceed MAX_PATH characters.
Windows NT Restriction lifted

 

Points to the WIN32_FIND_DATA structure that receives information about the found file or subdirectory. The structure can be used in subsequent calls to the FindNextFile or FindClose function to refer to the file or subdirectory.

 
Return value
If the function succeeds, the return value is a search handle used in a subsequent call to FindNextFile or FindClose
If the function fails, the return value is INVALID_HANDLE_VALUE (-1).
 
Example
George de Greef's "Array of files in a directory"
 
Comments
 
See also

FindNextFile()

FindClose()