程序有句代码是这样的“
Label1.Caption = (Loc(1) * 100 / lDatalen) & "%"
运行起来的结果是,程序保留了13位左右的小数点
Select Case State
'...没有列举其它情况。
Case icError '11
vtData = Inet1.ResponseCode & ":" & Inet1.ResponseInfo
Case icResponseCompleted ' 12
Dim bDone As Boolean: bDone = False
Dim lDatalen As Long: lDatalen = 0
vtData() = Inet1.GetChunk(1024, 1) DoEvents
Open savefile.Text For Binary Access Write As #1
If Len(Inet1.GetHeader("Content-Length")) > 0 Then lDatalen = CLng(Inet1.GetHeader("Content-Length"))
' CLng(Inet1.GetHeader("Content-Length")) 为文件大小
Do While Not bDone
Put #1, Loc(1) + 1, vtData()
vtData() = Inet1.GetChunk(1024, 1)
DoEvents
Label1.Caption = (Loc(1) * 100 / lDatalen) & "%" ProgressBar1.Value = 100 * (Loc(1) / lDatalen)
If Loc(1) >= lDatalen Then bDone = True
Loop
Close #1
MsgBox "下载完成", vbInformation,
End Select
End Sub
胡说叔叔
温温酱