Private Sub Form_Load()
savefile.Text = "http://ip.xxx.com/xxxx/Server.zip" 'App.Path
StartDownLoad savefile
End SubPrivate Sub StartDownLoad(ByVal Geturl As String)
Dim spo%, filename$
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
savefile.Text = App.Path & "\Server.exe"
Inet1.Execute Geturl, "get"   '开始下载
End SubPrivate Sub Inet1_StateChanged(ByVal State As Integer)
   'State = 12 时,用 GetChunk 方法检索服务器的响应。
   Dim vtData() As Byte
   Select Case State
   '...没有列举其它情况。
   Case icError '11
      '出现错误时,返回 ResponseCode 和 ResponseInfo。
      vtData = Inet1.ResponseCode & ":" & Inet1.ResponseInfo
   Case icResponseCompleted ' 12
      Dim bDone As Boolean: bDone = False
      '取得第一个块。
      vtData() = Inet1.GetChunk(1024, 1)
      DoEvents
      Open savefile.Text For Binary Access Write As #1     '设置保存路径文件后开始保存
      '获取下载文件长度
      If Len(Inet1.GetHeader("Content-Length")) > 0 Then ProgressBar1.Max = CLng(Inet1.GetHeader("Content-Length"))
      
      '循环分块下载
      Do While Not bDone
         Put #1, Loc(1) + 1, vtData()
         vtData() = Inet1.GetChunk(1024, 1)
         DoEvents
         ProgressBar1.Value = Loc(1)   '设置进度条长度
         If Loc(1) >= ProgressBar1.Max Then bDone = True
      Loop
       
      Close #1
      Form3.Hide
      Me.Hide
      Login.Show
   End Select
   
End Sub
'我从网上下载一个文件,同时显示进度条。
'有个问题:有些人打开的时候,卡在进度条开始的地方。一点反应也没有。。
'我的电脑也出现过,一直找不到什么原因,后来不知道怎么弄的又好了