您的位置:首页 > 编程语言 > VB

VB 使用Webbrowser控件下载图片 源码

2007-08-10 23:14 441 查看
Private Sub webSky_DownloadComplete()
On Error Resume Next
WebSky.Silent = True
Me.MousePointer = vbDefault

Dim x, CtrlRange
Dim sPath As String

sPath = App.Path

sPath = Left(sPath, InStr(sPath, vbNullChar) - 1)
If Len(sPath) > 3 Then sPath = sPath & "/"

If Trim(txtUser.Text) <> "" Then
gstrFileName = sPath & Trim(txtUser.Text) & "Code.bmp"
Else
gstrFileName = sPath & "TempCode.bmp"
End If

For Each x In WebSky.Document.All
If x.tagName = "IMG" Then
WebSky.Stop
Set CtrlRange = WebSky.Document.body.createControlRange()
CtrlRange.Add (x)
CtrlRange.execCommand ("Copy")

SavePicture Clipboard.GetData, gstrFileName

'getCodeForSky

End If
End If
Next
End Sub
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐