"", vbTextCompare)
newl = Right(ln, Len(ln) - InStrRev(ln, "/"))
whostr = whostr & newl
If ln <> "" Then
''判定文件是否
下载过。
If fileexists(spath & newl) = False Then
links(i) = addsuf & ln
i = i + 1
Else
lmtime = inet1.getheader("Last-modified")
Set f = fs.getfile(spath & newl)
ctime = f.datecreated
''判断文件是否更新
If DateDiff("s", lmtime, ctime) < 0 Then
i = i + 1
End If
End If
End If
po1 = InStr(po2 + 1, strData, "href=", vbTextCompare) + 5
Loop
newstr = Mid(strData, po2)
whostr = whostr + newstr
Set a = fs.createtextfile(spath & fname, True)
a.Write whostr
a.Close
k = i
Else
Dim vtData As Variant
Dim b() As Byte
Dim bDone As Boolean: bDone = False
vtData = Inet2.GetChunk(1024, icByteArray)
Do While Not bDone
b() = b() & vtData
vtData = Inet2.GetChunk(1024, icByteArray)
If Len(vtData) = 0 Then
bDone = True
End If
Loop
Open spath & fname For Binary Access Write As #1
Put #1, , b()
Close #1
End If
Call devjob ''调用线程调度子
程序 End Select
End Sub
Private Sub Inet2_StateChanged(ByVal State As Integer)
end sub
线程调度子
程序,g和是k公用变量,k为最后一个链接的数组索引加一,g初值为零,每次加一,直到处理完最后一个链接。
Private Sub devjob()
If Not g + 1 < k Then GoTo reportline
If Inet1.StillExecuting = False Then
g = g + 1
Inet1.Execute links(g), "GET"
End If
If Not g + 1 < k Then GoTo reportline
If Inet2.StillExecuting = False Then
g = g + 1
Inet2.Execute links(g), "GET"
End If
reportline:
If Inet1.StillExecuting = False And Inet2.StillExecuting = False And Then
MsgBox ("
下载结束。")
End If