Delphi 获取网站验证码的图片


本文整理自网络,侵删。

 uses
  ActiveX,ComObj;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
  OleInitialize(nil);
end;

procedure TfrmMain.DomImg2Image(wb:TWebBrowser);
var
  i:Integer;
  rang:IHTMLControlRange;
  s:string;
begin
  try
  //pic是图片的节点(层)名称,你打开源代码看一下,替换成你的就行了
  s := (IHTMLDocument2(wb.Document).images.item('pic',EmptyParam) as IHTMLElement).getAttribute('src',0);
  //showmessage(s);
      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 TfrmMain.FormDestroy(Sender: TObject);
begin
  OleUninitialize;
end;

相关阅读 >>

Delphi窗口显示于parent控件上

Delphi unigui日志的控制

Delphi在memo按键实现全选

Delphi 获取本机公网ip

Delphi decodedate、decodetime ... decodedatetime ... 分解时间

Delphi过滤一段字符里面的html代码的函数

Delphi工具之tdump

Delphi indy 10tidftp中的directorylisting使用

Delphi 单击android上的web浏览器链接以启动Delphi应用程序

Delphi 构建时间 -encodedatetime … tryencodedatetime

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    正在狠努力加载,请稍候...