1,502
社区成员
发帖
与我相关
我的任务
分享
Private Sub GetLinks()
Dim Doc As IHTMLDocument2
Dim All As IHTMLElementCollection
Dim L As Integer
Dim i As Integer
Dim Varl As Variant
Set Doc = WebBrowser1.Document
Set All = Doc.images
L = All.length
For i = 0 To L - 1
Set Varl = All.Item(i, varempty)
List1.AddItem (Varl.href)
Set Varl = Nothing
Next i
Set All = Nothing
Set Doc = Nothing
Label1.Caption = List1.ListCount + 1
End Sub
Private Sub Command1_Click()
For i = 0 To List1.ListCount - 1
downFile List1.List(i)
Next
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://zy.muwen.com/pic/85/2008/07/15/142868.htm"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, url As Variant)
GetLinks
End Sub
Private Function downFile(url As String)
Dim bytes() As Byte
bytes() = Form1.Inet1.OpenURL(url, icByteArray)
Dim tempS
tempS = Split(url, "/")
Dim fName As String
fName = tempS(UBound(tempS))
fName = App.Path & "\" & "图片" & "\" & fName
Open fName For Binary Access Write As #1
Put #1, , bytes()
Close #1
End Function