|
Private Sub Command1_Click()
Inet1.AccessType = icUseDefault Inet1.URL = "http://example.microsoft.com/somefile.exe" Inet1.Execute , "GET" End Sub Private Sub Inet1_StateChanged(ByVal State As Integer) Dim vtData As Variant Select Case State ' ... Other cases not shown. Case icResponseCompleted ' 12 Dim bDone As Boolean: bDone = False Dim tempArray() As Byte filesize = Inet1.GetHeader("Content-length") contenttype = Inet1.GetHeader("Content-type") Open "C:\somefile.exe" For Binary Access Write As #1 ' Get first chunk. vtData = Inet1.GetChunk(1024, icByteArray) DoEvents If Len(vtData) = 0 Then bDone = True End If Do While Not bDone tempArray = vtData Put #1, , tempArray ' Get next chunk. vtData = Inet1.GetChunk(1024, icByteArray) DoEvents If Len(vtData) = 0 Then bDone = True End If Loop Close #1 End Select End Sub |