The FindFirstFileEx function searches a directory for a file whose name and attributes match those specified in the function call.
HANDLE FindFirstFileEx(
LPCTSTR lpFileName, // pointer to the name of the file to
// search for
FINDEX_INFO_LEVELS fInfoLevelId,
// information level of the returned data
LPVOID lpFindFileData, // pointer to the returned information
FINDEX_SEARCH_OPS fSearchOp,
// type of filtering to perform
LPVOID lpSearchFilter, // pointer to search criteria
DWORD dwAdditionalFlags // additional search control flags
);
If the function succeeds, the return value is a search handle that can be used in a subsequent call to the FindNextFile or FindClose functions.
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.
The FindFirstFileEx function is provided to open a search handle and return information about the first file whose name matches the specified pattern and attributes.
If the underlying file system does not support the specified type of filtering, other than directory filtering, FindFirstFileEx fails with the error ERROR_NOT_SUPPORTED. The application has to use FINDEX_SEARCH_OPS type FileExSearchNameMatch and perform its own filtering.
Once established, the search handle can be used in the FindNextFile function to search for other files that match the same pattern with the same filtering being performed. When the search handle is no longer needed, it should be closed using the FindClose function.
The call
FindFirstFileEx( lpFileName,
FindExInfoStandard,
lpFindData,
FindExSearchNameMatch,
NULL,
0 );
is equivalent to the call
FindFirstFile( lpFileName, lpFindData);
Windows NT: Requires version 4.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
File I/O Overview, File Functions, FINDEX_INFO_LEVELS, FINDEX_SEARCH_OPS, FindFirstFile, FindNextFile, FindClose