VB Code:
Private Sub Inet1_StateChanged(ByVal state As Integer)
Dim vtData As Variant
Dim strFileName As String
Dim lngLength As Long
Select Case state
Case icResponseCompleted
Dim bDone As Boolean: bDone = False
Dim tempArray() As Byte
strFileName = txtSavePath.Text & lstDownload.Text
Open strFileName For Binary Access Write As #1
vtData = Inet1.GetChunk(1024, icByteArray)
DoEvents
If Len(vtData) = 0 Then
bDone = True
End If
Do While Not bDone
tempArray = vtData
Put #1, , tempArray
vtData = Inet1.GetChunk(1024, icByteArray)
DoEvents
lngLength = lngLength + 1024 \ 1024
lblBytes.Caption = "Progress: " & lngLength & "kb"
If Len(vtData) = 0 Then
bDone = True
End If
Loop
Close #1
End Select
End Sub