I have a function to check if a file on ftp server exists, here it is:
It works, it check if there is a file or folder in the current FTP directory.
Public Function RemoteExists(strFile As String) As Boolean
Dim hSearch As Long
Dim FData As WIN32_FIND_DATA
If strFile = "" Then Exit Function
hSearch = FtpFindFirstFile(hConnection, strFile, FData, 0, 0) 'The hConnection is the handle of a ftp session (this code is a part of a class)
If hSearch <> 0 Then
RemoteExists = True
My problem is that when I call this function many times the computer slows down.
After 20-40 calls, all the computer is very slow. When this loop finishes and I want to call others wininet functions like FtpGetCurrentDirectory they also slows down my computer. But when I shut down and open the FTP session again the function executes as fast as before.
Dim x as Integer
For x=0 To 100
RemoteExists "abc" & x
Can you tell me what is happening???