Samy
Feb 6th, 2001, 10:02 AM
I am writing a small ftp program and have a question -
I realize there is a function called FtpGetFile but this does not allow for the monitoring of bytes recieved. If it does then I am not aware of how to use it.
I am trying to create a recieving progress bar. I already have the send progress bar and use InternetWriteFile to accomplish this. With InternetWriteFile I assumed I could use InternetReadFile in about the same way. Below is my current - non working - idea
Dim Data_A(99) As Byte
Dim Written As Long, szFileRemote As String, szFileLocal As String
Dim bDoLoop As Boolean
szFileRemote = List1.Text
szFileLocal = List1.Text
hFile = FtpOpenFile(hConnection, szFileRemote, &H40000000, dwType, 0)
If hFile = 0 Then
ErrorOut Err.LastDllError, "FtpOpenFile"
Exit Function
End If
Open szFileLocal For Binary As #1
bDoLoop = True
While bDoLoop
InternetReadFile hFile, Data_A(0), Len(Data_A(0)), Written
Put #1, , Left$(Data_A(0), Written)
If Not CBool(Written) Then bDoLoop = False
Wend
Close #1
InternetCloseHandle (hFile)
Please if someone could help me with this I would be very gracious.
I realize there is a function called FtpGetFile but this does not allow for the monitoring of bytes recieved. If it does then I am not aware of how to use it.
I am trying to create a recieving progress bar. I already have the send progress bar and use InternetWriteFile to accomplish this. With InternetWriteFile I assumed I could use InternetReadFile in about the same way. Below is my current - non working - idea
Dim Data_A(99) As Byte
Dim Written As Long, szFileRemote As String, szFileLocal As String
Dim bDoLoop As Boolean
szFileRemote = List1.Text
szFileLocal = List1.Text
hFile = FtpOpenFile(hConnection, szFileRemote, &H40000000, dwType, 0)
If hFile = 0 Then
ErrorOut Err.LastDllError, "FtpOpenFile"
Exit Function
End If
Open szFileLocal For Binary As #1
bDoLoop = True
While bDoLoop
InternetReadFile hFile, Data_A(0), Len(Data_A(0)), Written
Put #1, , Left$(Data_A(0), Written)
If Not CBool(Written) Then bDoLoop = False
Wend
Close #1
InternetCloseHandle (hFile)
Please if someone could help me with this I would be very gracious.