Howto
use a progressbar while downloading a file
Actually,
this method is quite easy. Instead of downloading the
file in one part, we 'split' the file in several parts
and download each part after each other. Between two
parts, we can update our progress bar:
Const
BytesPerTime = 1024
For Cnt = 0 To FileSize Step BytesPerTime
DoEvents
If Cnt + BytesPerTime > FileSize Then
InternetReadFile frmUpdate.hFile, bBytes(Cnt),
FileSize - Cnt, Ret
Else
InternetReadFile frmUpdate.hFile, bBytes(Cnt),
BytesPerTime, Ret
End If
SetProgressValue Cnt / FileSize * 100
Next Cnt
Read here
to download files asynchronously
|