FindClose

The FindClose function closes a search handle created by a call to the FindFirstFileEx or FindFirstFile function.

Syntax

BOOL FindClose(
      HANDLE hFindFile
    );
  

Parameters

hFindFile

A handle to the file search. This handle must have been previously opened by the FindFirstFile or FindFirstFileEx function.

Return value

If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

After calling FindClose, the handle specified by hFindFile is no longer valid and can no longer be used.

You must call FindClose for every handle that is created by a successful call to FindFirstFile or FindFirstFileEx. Failure to do so results in a resource leak.

If FindFirstFile or FindFirstFileEx fails, you do not need to call FindClose, because no handle is created.