FindNextFileW Function

File Management > Directory Management

Syntax


BOOL FindNextFileW(
  [in]  HANDLE hFindFile,
  [out] LPWIN32_FIND_DATAW lpFindFileData
);
                

Parameters:

  • hFindFile [in] A handle to the search that was returned by a previous call to the FindFirstFileW function.
  • lpFindFileData [out] A pointer to a WIN32_FIND_DATAW structure that receives information about a file or directory found.

Return value

If the function succeeds, the return value is nonzero. If the function fails or if there are no more files to be found, the return value is zero. To get extended error information, call GetLastError.

  • If the function finds a file or directory, the return value is TRUE. The information about the file or directory is returned in the lpFindFileData structure.
  • If no files or directories are found, or if an error occurs, the return value is FALSE. Call GetLastError to determine the cause of the error.

Remarks

The FindNextFileW function retrieves information about the next file or directory in the specified directory that matches the search criteria from the calling FindFirstFileW function. To start the search, you must first call FindFirstFileW.

The search that FindNextFileW performs is case-sensitive on the FAT file system and case-insensitive on the NTFS file system. For maximum portability, your application should not assume that the comparison is case-sensitive or case-insensitive.

The order in which FindNextFileW returns the files is not guaranteed to be alphabetical or in any other specific order.

When you are finished with the search handle, call the FindClose function to free system resources.

Requirements

Capability Value
Minimum supported client Windows 2000 Professional
Minimum supported server Windows 2000 Server
Header fileapi.h (include windows.h)
Library Kernel32.lib
DLL Kernel32.dll
Unicode and ANSI versions FindNextFileW (Unicode) and FindNextFileA (ANSI)