誰可以給我個寫法 ...
一個button
一個webbrowser
一個image
按下button 把WEBROWSER的 認證碼圖片保存在內存 之後再IMAGE顯示出來圖片原始碼如下
<span style="font-size: 14px;">認證碼</span>
<table>
<tr>
<td>
<table>
<tr>
<td>
<p class="agreeBtn">
</td>
<td>
<div class='LBD_CaptchaDiv' style='width:228px; height: 44px;'>
<div class='LBD_CaptchaImage' style='width:200px; height: 40px; '>
<img id='signup_join_beanfun_signup_samplecaptcha_CaptchaImage' src='LanapCaptcha.aspx?get=image&c=signup_join_beanfun_signup_samplecaptcha&t=b2629cece2b74db4a8476c1489a68978&s=RTU46AURGsmKAxaDrT91%2b%2bk5znR%2bk9tzri9SwrOQS8I%3d' alt='CAPTCHA code image' />
</div><div class='LBD_CaptchaIcons'><a href='#' onclick='LBD_ReloadImage("signup_join_beanfun_signup_samplecaptcha_CaptchaImage");this.blur();return false;' title='重新取得'><img src='/TW/WebResource.axd?d=dCkrq-FWCLLZXD1ZhRiMuAWAYu8rbgsizziWE5SSuwYmrBuX2BYEZNYOlveDWlEYrlJEGNG9QM0HY2TtgOXbhH7B7wRuB4Z3DsgMKXOtuWyKMIAGEiqlmuG8b8r19KQB_fNMfLti9wRz35jIy92yvAEtsM01&t=634848858400000000' alt='重新取得' /></a></div></div>
<input type="hidden" name="LBD_VCT_signup_join_beanfun_signup_samplecaptcha" id="LBD_VCT_signup_join_beanfun_signup_samplecaptcha" value="b2629cece2b74db4a8476c1489a68978" />求寫法
一個button
一個webbrowser
一個image
按下button 把WEBROWSER的 認證碼圖片保存在內存 之後再IMAGE顯示出來圖片原始碼如下
<span style="font-size: 14px;">認證碼</span>
<table>
<tr>
<td>
<table>
<tr>
<td>
<p class="agreeBtn">
</td>
<td>
<div class='LBD_CaptchaDiv' style='width:228px; height: 44px;'>
<div class='LBD_CaptchaImage' style='width:200px; height: 40px; '>
<img id='signup_join_beanfun_signup_samplecaptcha_CaptchaImage' src='LanapCaptcha.aspx?get=image&c=signup_join_beanfun_signup_samplecaptcha&t=b2629cece2b74db4a8476c1489a68978&s=RTU46AURGsmKAxaDrT91%2b%2bk5znR%2bk9tzri9SwrOQS8I%3d' alt='CAPTCHA code image' />
</div><div class='LBD_CaptchaIcons'><a href='#' onclick='LBD_ReloadImage("signup_join_beanfun_signup_samplecaptcha_CaptchaImage");this.blur();return false;' title='重新取得'><img src='/TW/WebResource.axd?d=dCkrq-FWCLLZXD1ZhRiMuAWAYu8rbgsizziWE5SSuwYmrBuX2BYEZNYOlveDWlEYrlJEGNG9QM0HY2TtgOXbhH7B7wRuB4Z3DsgMKXOtuWyKMIAGEiqlmuG8b8r19KQB_fNMfLti9wRz35jIy92yvAEtsM01&t=634848858400000000' alt='重新取得' /></a></div></div>
<input type="hidden" name="LBD_VCT_signup_join_beanfun_signup_samplecaptcha" id="LBD_VCT_signup_join_beanfun_signup_samplecaptcha" value="b2629cece2b74db4a8476c1489a68978" />求寫法
解决方案 »
- TCPclient的连接问题
- 问些结婚礼仪方面的事
- 穿两条内裤了,散点分,hehe~~~~~~~~~~~~~
- 如何查询2个表的数据---Sql语句的问题
- D7程序在98下动行错误
- WORD 高手:Delphi加Word,如何可以得到WORD中的单元格(宽度固定的单元格)中可写字符个数
- [microsoft][odbc sql server driver]没有执行可选特性
- 怎么删除数据库里的有两条一样的记录的其中一条,保留一条?
- 有哪位高手知道哪里可以找到WMA的文件格式!只需要读取各个版本的WMA的信息就可以了!
- 100分~dll中调用form的问题~在panel里showmodal后,整个程序无法操作
- 关于pagecontrol中含有webbrowser的页面关闭问题
- 关于循环GetMem分配空间,一些问题请教.
var
i:Integer;
rang:IHTMLControlRange;
s:string;
begin
try
s := (IHTMLDocument2(wb.Document).images.item('pic',EmptyParam) as IHTMLElement).getAttribute('src',0);
rang:=((IHTMLDocument2(wb.Document).body as HTMLBody).createControlRange)as
IHTMLControlRange;
rang.add(IHTMLDocument2(wb.Document).images.item('pic',EmptyParam)as
IHTMLControlElement);
rang.execCommand('Copy',False,0);
image1.Picture.Assign(ClipBoard);
except
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:Integer;
rang:IHTMLControlRange;
s:string;
begin
try
s := (IHTMLDocument2(webbrowser1.Document).images.item('signup_join_beanfun_signup_samplecaptcha_CaptchaImage',EmptyParam)as IHTMLElement).getAttribute('LanapCaptcha.aspx?get=image&c=signup_join_beanfun_signup_samplecaptcha&t=d10d9114a3784d8eb46a70e752c6aea4&s=B%2bx0RN36Kv%2bKylW0opJhn%2fDf5Dsnpq1Hri9SwrOQS8I%3d',0);
rang:=((IHTMLDocument2(webbrowser1.Document).body as HTMLBody).createControlRange)as IHTMLControlRange;
rang.add(IHTMLDocument2(webbrowser1.Document).images.item('signup_join_beanfun_signup_samplecaptcha_CaptchaImage',EmptyParam)as
IHTMLControlElement);
rang.execCommand('Copy',False,0);
image1.Picture.Assign(ClipBoard);
except
end;
end;他卻說
单元文件unit Unit11;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw, ExtCtrls;type
TForm11 = class(TForm)
btn1: TButton;
img1: TImage;
wb1: TWebBrowser;
btn2: TButton;
mmo1: TMemo;
edt1: TEdit;
procedure FormCreate(Sender: TObject);
procedure btn2Click(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form11: TForm11;implementation
uses ActiveX, wininet, mshtml, Clipbrd;
{$R *.dfm}procedure DomImg2Image(id:string; wb:TWebBrowser; img:TImage );
var
rang:IHTMLControlRange;
begin
rang:=((IHTMLDocument2(wb.Document).body as HTMLBody).createControlRange)as
IHTMLControlRange;
rang.add(IHTMLDocument2(wb.Document).images.item(id,EmptyParam)as
IHTMLControlElement);
rang.execCommand('Copy',False,0);
img.Picture.Assign(ClipBoard);
end;procedure TForm11.btn1Click(Sender: TObject);
var
i:Integer;
rang:IHTMLControlRange;
begin
//遍历图片元素, 在memo中显示Img的ID和src属性
mmo1.clear;
for i:= 0 to IHTMLDocument2(wb1.Document).images.length-1 do
begin
mmo1.lines.add((IHTMLDocument2(wb1.Document).images.item(i,EmptyParam)as
IHTMLElement).getAttribute('id',0));
mmo1.lines.add((IHTMLDocument2(wb1.Document).images.item(i,EmptyParam)as
IHTMLElement).getAttribute('src',0));
end;
end;procedure TForm11.btn2Click(Sender: TObject);
begin
//edt1.Text是Img的ID值, webbrowse对象, TImage
DomImg2Image(edt1.Text, wb1, img1);
end;procedure TForm11.FormCreate(Sender: TObject);
begin
wb1.Navigate('c:\aa.html');
end;end.aa.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<img id='signup_join_beanfun_signup_samplecaptcha_CaptchaImage' src='http://www.baidu.com/img/shouye_b5486898c692066bd2cbaeda86d74448.gif' alt='CAPTCHA code image' />
<img src='http://info-database.csdn.net/Upload/2012-10-08/amd-475-60-1008.jpg' alt='重新取得' /></body>
</html>
1,WEB内copy获得
2,idhttp获得
3,缓存获得
个人感觉第一个可能是最稳妥的方法,2可能获得的不一样,3有的可能获得不到