MSDN Library
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.


Windows Mobile 6.5
A version of this page is also available for

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

HANDLE FindFirstFileEx(
  LPCTSTR lpFileName, 
  LPVOID lpFindFileData, 
  LPVOID lpSearchFilter, 
  DWORD dwAdditionalFlags 


[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 (?).


[in] FINDEX_INFO_LEVELS enumeration type that specifies the information level of the returned data.


[out] Pointer to a WIN32_FIND_DATA structure.


[in] FINDEX_SEARCH_OPS enumeration type that specifies the type of filtering to perform beyond wildcard matching.


[in] Pointer that must be set to NULL.


[in] Unsupported. Set to zero.

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.

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);

Windows Embedded CEWindows CE 3.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

© 2016 Microsoft