高手请进!如何使用TWebbrowser来保存网页里验证码的图片!仅只需获取证码的图片流!谢谢
如何使用TWebbrowser来保存网页里验证码的图片!仅只需获取证码的图片流!
我用这样的方式来做
procedure TForm1.Button5Click(Sender: TObject);
var
d2,D:IHTMLDocument2;
d1:IHTMLDocument;
e:IHTMLElement;
e2:IHTMLElement2;
cp:IHTMLControlRange;
img:IHTMLImgElement;
ce:IHTMLControlElement;
begin
try
D:= vCodeWeb.Document as IHTMLDocument2;
e:=d.body as IHTMLElement;
e2:=e as IHTMLElement2;
cp:=e2.createControlRange as IHTMLControlRange;
d2:= vCodeWeb.Document as IHTMLDocument2;
img:=d2.images.item('G',0) AS IHTMLImgElement;
ce:=img as IHTMLControlElement;
cp.add(ce);
cp.execCommand('Copy',false,0);
except
on e:Exception do
showmessage(e.Message);
end;
end;
结果是这样的 静态的图片没有问题,可是验证码的图片是由JSP,PHP,ASP动态生成的。HTML里是这样的 <IMG SRC="inc/code.asp"> 请问如何获取这个图片流。谢谢