Visual Basic 6.0
Visual Basic 6.0
HTTP Download with Progress Event Callbacks
See more HTTP Examples
Downloads a file via HTTP or HTTPS and uses event callbacks to monitor progress.Chilkat Visual Basic 6.0 Downloads
Dim WithEvents http As ChilkatHttp
' AbortCheck callback method.
Private Sub http_AbortCheck(abort As Long)
End Sub
' PercentDone callback method.
Private Sub http_PercentDone(ByVal percentDone As Long, abort As Long)
Debug.Print "Percent Done: " & percentDone
' Explicitly abort at 25% or greater.
' Remove this to allow for the HTTP download to run to completion.
If (percentDone > 25) Then
abort = 1
End If
End Sub
' ProgressInfo callback method.
Private Sub http_ProgressInfo(ByVal name As String, ByVal value As String)
Debug.Print name & ": " & value
End Sub
private Sub ChilkatExample()
Dim success As Long
success = 0
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Set http = New ChilkatHttp
' Set a heartbeat in milliseconds
http.HeartbeatMs = 200
' Download a file...
Dim localFilePath As String
localFilePath = "qa_output/Python-3.4.4.tar.xz"
success = http.Download("https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tar.xz",localFilePath)
If (success = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Debug.Print "OK!"
End Sub