Compartilhar via


FindFirstFileEx

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function searches a directory for a file with the specified name and attributes.

Syntax

HANDLE FindFirstFileEx(
  LPCTSTR lpFileName, 
  FINDEX_INFO_LEVELS fInfoLevelId, 
  LPVOID lpFindFileData, 
  FINDEX_SEARCH_OPS fSearchOp, 
  LPVOID lpSearchFilter, 
  DWORD dwAdditionalFlags 
);

Parameters

  • lpFileName
    [in] Pointer to a null-terminated string that specifies a valid directory or path and file name, which can contain wildcard characters such as an asterisk (*) or a question mark (?).
  • fInfoLevelId
    [in] FINDEX_INFO_LEVELS enumeration type that specifies the information level of the returned data.
  • fSearchOp
    [in] FINDEX_SEARCH_OPS enumeration type that specifies the type of filtering to perform beyond wildcard matching.
  • lpSearchFilter
    [in] Pointer that must be set to NULL.
  • dwAdditionalFlags
    [in] Unsupported. Set to zero.

Return Value

A search handle that can be used in a subsequent call to the FindNextFile or the FindClose functions indicates success. INVALID_HANDLE_VALUE indicates failure. To get extended error information, call GetLastError.

Remarks

This function opens a search handle to obtain information about the first file with the specified name and attributes. File name searches are not case-sensitive.

If the underlying file system does not support the specified type of filtering other than directory filtering, this function fails and returns ERROR_NOT_SUPPORTED. The application must use the FileExSearchNameMatch type in the FINDEX_SEARCH_OPS structure and perform its own filtering.

Once established, the search handle can be used in FindNextFile to search for other files that match the same name and attributes with the same filtering being performed. When the search handle is no longer needed, close it by using the FindClose function.

The following calls to this function and FindFirstFile are equivalent.

FindFirstFileEx(lpFileName, FindExInfoStandard, lpFindData, FindExSearchNameMatch, NULL, 0);
FindFirstFile(lpFileName, lpFindData);

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

File I/O Functions
FindClose
FindFirstFile
FindNextFile
FINDEX_INFO_LEVELS
FINDEX_SEARCH_OPS
WIN32_FIND_DATA