Mensaje enviado por Quintero Rojas Daniel <dquintero@meximed.com>
Download Files, with Progress Bar.
Category: Internet/ HTML
Level: Intermediate
Description: I have seen many download functions on PSC but none with any
progress bars. Still this is very simple I thought I would share this piece
of code with PSC. Please Vote if you found this useful.
Complete source code is at:
http://www.planet-source-code.com/vb/default.asp?lngCId=28987&lngWId=1
Compatibility: VB 6.0
Submitted on 11/18/2001 1:22:36 PM and accessed 187 times.
'**************************************
' Name: Download Files, with Progress Ba
' r.
' Description:I have seen many download
' functions on PSC but none with any progr
' ess bars. Still this is very simple I th
' ought I would share this piece of code w
' ith PSC. Please Vote if you found this u
' seful.
' By: [AKA]sassyboy
'
' Assumes:You must create a progressbar,
' nameed progressbar1. You must have an In
' et, named Inet1. From there you can use
' the command Download(URL, Destionation o
' f file.
'
'This code is copyrighted and has
' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/xq/ASP/txtCode
' Id.28987/lngWId.1/qx/vb/scripts/ShowCode
' .htm
'for details.
'**************************************
Public Sub download(Url As String, Destination As String)
Dim think As String
think = 0
Dim sentdata() As Byte
If Inet1.StillExecuting = True Then Exit Sub
sentdata() = Inet1.OpenURL(Url, icByteArray)
ProgressBar1.Max = Len(Url)
For x = Len(Url) To 1 Step -1
think = think + 1
ProgressBar1.Value = think
If Left$(Right$(Url, x), 1) = "/" Then RealFile$ = Right$(Url, x - 1)
Next x
gotFile$ = Destination + "\" + RealFile$
Open gotFile$ For Binary Access Write As #1
Put #1, , sentdata()
Close #1
End Sub
Lic. Daniel Quintero Rojas
Tel. Oficina (Meximed): (52) 5448-6700 Ext. 6719
E-mail: dquintero@meximed.com
dqrsoftware@gmx.net
dqrsoftware@hotmail.com
Página web: http://dqrsoftware.tripod.com/
¡SALUDOS DESDE MÉXICO!