Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wininet.dll

Status
Not open for further replies.

mmetze

Programmer
Oct 2, 2001
45
US
I am trying to use the WinINet.dll API functions to retrieve all of the filenames in a designated FTP directory by using the following generalized snippet of code...

hFind = FtpFindFirstFile(hConn, "*.*", pData, 0, 0)
While hFind <> 0
Call colFiles.Add(pData.cFileName)
pData.cFileName = String(MAX_PATH, 0)
hFind = InternetFindNextFile(hFind, pData)
Wend

... the problem is that only 2 entries are placed in the collection: &quot;.&quot; and &quot;..&quot;. I have placed 2 ASCII text files in the root of the ftp directory and can confirm that they exist in the root using ws_ftp. Do I need to indicate that the API functions should be retrieving files instead of dirs to retrieve these files?
 
My problem was attempting to use the return variable from InternetFindNextFile as the first parameter on subsequent calls to InternetFindNextFile. InternetFindNextFile does return a long, but this value will only be 0 or 1 (True or False). The pointer returned from the FTPFindFirstFile should be continually used so that the code looks like...

hFind = FtpFindFirstFile(hConn, &quot;*.*&quot;, pData, 0, 0)
While hFind <> 0
Call colFiles.Add(pData.cFileName)
pData.cFileName = String(MAX_PATH, 0)
hSuccess = InternetFindNextFile(hFind, pData)
Wend
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top