vb源码webbrowser如何保存网页上图片(按图片链接查找)
'┏〓〓〓〓〓〓〓〓〓 SaveWebImgUrlLike,start 〓〓〓〓〓〓〓〓〓┓
'[简介]:
'保存网页上图片(按图片链接查找)
Function SaveWebImgUrlLike(Web1 As WebBrowser, UrlLike As String, Optional SaveToFile As String, Optional url As String) As Boolean
'[mycode_id:2041],edittime:2011-9-9 下午 02:45:37
On Error GoTo eRR
Dim x
Dim CtrlRange
For Each x In Web1.document.All
If x.TagName = "IMG" Then
If x.src Like UrlLike Then
url = x.src
' MsgBox url
Set CtrlRange = Web1.document.body.createControlRange()
CtrlRange.Add (x)
Clipboard.Clear
CtrlRange.execCommand ("Copy")
End If
End If
Next
On Error Resume Next
If SaveToFile <> "" Then
Kill SaveToFile
SavePicture Clipboard.GetData, SaveToFile
End If
SaveWebImgUrlLike = eRR.Number = 0
Exit Function
eRR:
End Function
'┗〓〓〓〓〓〓〓〓〓 SaveWebImgUrlLike,end 〓〓〓〓〓〓〓〓〓┛