PDA

Click to See Complete Forum and Search --> : FindNextFile


TnT
Oct 10th, 2000, 09:28 AM
Is it necessary to close a handle returned by the FindNextFile function?


I have 2 loops. Which one is the best?
(I always close handle from FindFirstFile.)


Dim hFile as long, hNextFile as long
Dim tWFD As WIN32_FIND_DATA

hFile = FindFirstFile(sFileName, tWFD)

Do
' Do something here
Loop While FindNextFile(hFile, tWFD)

Do
hNextFile = FindNextFile(hFile, tWFD)
Call FindClose(hNextFile) ' Close the search handle
' Do something here
Loop Until hNextFile = 0