1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
Dim taille, pourcent As Integer
Dim fic_source, fic_destination As String
fic_source = "version"
'Fichier a telecharger.
fic_destination = "test" 'Fichier de destination.
With Inet1
.Protocol = icFTP
'Declaration protocole.
.url = "ftp://81.48.100.217" '"ftp://user:pass@serverftp" 'le ftp.
.UserName = "testing"
.password = "win"
End With
lblinfo.Caption = "Connexion en cour..."
Inet1.Execute , "SIZE" & fic_source
Do Until Inet1.StillExecuting = False
DoEvents
Loop
taille = Inet1.GetChunk(512) 'Recuperation de la taille dans taille.
pb.Value = 0 'Definition de la valeur minimum.
pb.Max = taille 'Definition de la valeur maximum.
Inet1.Execute , "get " & fic_source & " " & fic_destination
Do Until Inet1.StillExecuting = False
On Error Resume Next
DoEvents
pb.Value = FileLen(fic_destination)
pourcent = (pb.Value / taille) * 100
Label1.Caption = pourcent & "%" 'Affichage du % du telechargement
Loop
Inet1.Execute , "close "
End If |
Partager