关闭

Inet1 按字节下载文件!!

988人阅读 评论(0) 收藏 举报

因为用到了 就抄了过来 .

程序文件升级时,很有用的 :)

 

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

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:56571次
    • 积分:869
    • 等级:
    • 排名:千里之外
    • 原创:25篇
    • 转载:9篇
    • 译文:0篇
    • 评论:12条
    文章分类