获取验证码问题
这是验证码 相关部分
<td align="center" bgcolor="#F2F2F2">验 证 码:</td> <td align="left" bgcolor="#F2F2F2"><input tabindex="3" name="tbCode" id="tbCode" type="text" class="bk" size="8" /><img class="btn" src="code.en.img.php" align="absmiddle" onclick="this.src='code.en.img.php?'+Math.random()" title="点击图片换一张" />
Dim html As HTMLDocument = DirectCast(Me.WebBrowser1.Document.DomDocument, HTMLDocument) '下面代码中,获取图片的方式有很多,因为比较简单,我就不列举了,直接用ID来做为例子的 Dim img As IHTMLControlElement = DirectCast(WebBrowser1.Document.Images("randNumber").DomElement, IHTMLControlElement) Dim range As IHTMLControlRange = DirectCast(DirectCast(html.body, HTMLBody).createControlRange(), IHTMLControlRange) range.add(img) range.execCommand("Copy", False, Nothing) img = Nothing range = Nothing html = Nothing If Clipboard.ContainsImage() Then Me.PictureBox1.Image = Clipboard.GetImage() Else MessageBox.Show("执行不成功") End If Clipboard.Clear()