Compartir a través de


FindFirstFile

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 or subdirectory with the specified file name.

A RAPI version of this function exists called CeFindFirstFile (RAPI).

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 file name, which can contain wildcard characters, such as an asterisk (*) or a question mark (?).

    The default string size limit for paths is MAX_PATH characters. This limit is related to how this function parses paths.

  • lpFindFileData
    [out] Pointer to the WIN32_FIND_DATA structure that receives information about the found file or subdirectory.

Return Value

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

Remarks

This function opens a search handle and returns information about the first file with the specified name. Once the search handle is established, use this function to search for other files that match the pattern. When the search handle is no longer needed, close it with FindClose.

This function searches for files by name only. It cannot be used for attribute-based searches.

Requirements

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

See Also

Reference

File I/O Functions
FindClose
FindNextFile
GetFileAttributes
WIN32_FIND_DATA
FindFirstFileEx