AllApi.net

[an error occurred while processing this directive]
 

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

 
Copyright © 1998-2000, The KPD-Team.
Send mail to KPDTeam@Allapi.net with comments about this web site.
This site is located at
http://www.Allapi.net/