因为用到了 就抄了过来 .
程序文件升级时,很有用的 :)
http: // www.cndevx.com / club / printpage.asp?BoardID = 30 & ID = 47949
文件地址
Private Sub Command1_Click()
Inet1.Execute , " Get "
End Sub
Private Sub Form_Load()
Inet1.URL = http: // 1122.122 . 221 / aaa.exe
End Sub
Private Sub Form_Unload(Cancel As Integer )
Inet1.Execute , " QUIT "
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer )
Dim aa As Variant
Dim vtData() As Byte ' 数据变量。
Dim TotalLength As Variant
If State = 12 Then
TotalLength = Val(Inet1.GetHeader( " Content-length " ))
psb.Max = TotalLength
Open " d:\cat.exe " For Binary Access Write As # 1
vtData = Inet1.GetChunk( 1024 , icByteArray)
Do While UBound (vtData) > 0
DoEvents
Put # 1 , , vtData
If (psb.Value + 1024 ) > psb.Max Then
psb.Value = psb.Max
Else
psb.Value = psb.Value + 1024
End If
vtData = Inet1.GetChunk( 1024 , icByteArray)
Loop
Put # 1 , , vtData
Close # 1
MsgBox " 下载完毕 "
End If
End Sub
程序文件升级时,很有用的 :)
http: // www.cndevx.com / club / printpage.asp?BoardID = 30 & ID = 47949
文件地址
Private Sub Command1_Click()
Inet1.Execute , " Get "
End Sub
Private Sub Form_Load()
Inet1.URL = http: // 1122.122 . 221 / aaa.exe
End Sub
Private Sub Form_Unload(Cancel As Integer )
Inet1.Execute , " QUIT "
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer )
Dim aa As Variant
Dim vtData() As Byte ' 数据变量。
Dim TotalLength As Variant
If State = 12 Then
TotalLength = Val(Inet1.GetHeader( " Content-length " ))
psb.Max = TotalLength
Open " d:\cat.exe " For Binary Access Write As # 1
vtData = Inet1.GetChunk( 1024 , icByteArray)
Do While UBound (vtData) > 0
DoEvents
Put # 1 , , vtData
If (psb.Value + 1024 ) > psb.Max Then
psb.Value = psb.Max
Else
psb.Value = psb.Value + 1024
End If
vtData = Inet1.GetChunk( 1024 , icByteArray)
Loop
Put # 1 , , vtData
Close # 1
MsgBox " 下载完毕 "
End If
End Sub