Compartilhar via


FindFirstFile (Compact 2013)

3/26/2014

This function searches a directory for a file or subdirectory with the specified file name.

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

See Also

Reference

File I/O Functions
FindClose
FindNextFile
GetFileAttributes
WIN32_FIND_DATA
FindFirstFileEx