1,502
社区成员
发帖
与我相关
我的任务
分享
'窗体添加一个WebBrowser,一个PictureBox,名称默认.
Option Explicit
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.m5home.com/blog/article.asp?id=201" '这个页面有验证码
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim I As Object, CR As Object
For Each I In WebBrowser1.Document.All
If I.tagName = "IMG" And I.Id = "vcodeImg" Then '判断一下ID就行了,这里是判断ID=vcodeImg的那个验证码.
Set CR = WebBrowser1.Document.body.createControlRange() '设置选区
CR.Add I '添加选区
CR.execCommand ("Copy") '复制
Set Picture1.Picture = Clipboard.GetData()
End If
Next
End Sub