This function searches a directory for a file whose name matches the specified file name. FindFirstFile examines subdirectory names as well as file names.
A remote application interface (RAPI) version of this function exists and it is named CeFindFirstFile.
At a Glance
Header file: | Winbase.h |
Windows CE versions: | 1.0 and later |
Syntax
HANDLE FindFirstFile(LPCTSTR lpFileName,
LPWIN32_FIND_DATA lpFindFileData);
Parameters
lpFileName
[in] Pointer to a null-terminated string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?).
There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the FindFirstFile function parses paths.
lpFindFileData
[out] Pointer to the WIN32_FIND_DATA structure that receives information about the found file or subdirectory.
Return Values
A search handle, used in a subsequent call to FindNextFile or FindClose, indicates success. INVALID_HANDLE_VALUE indicates failure. To get extended error information, call GetLastError.
Remarks
The FindFirstFile function opens a search handle and returns information about the first file whose name matches the specified pattern. Once the search handle is established, you can use the FindNextFile function to search for other files that match the same pattern. When the search handle is no longer needed, close it by using the FindClose function.
This function searches for files by name only; it cannot be used for attribute-based searches.
See Also
FindClose, FindNextFile, GetFileAttributes, SetFileAttributes, WIN32_FIND_DATA