乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      提取WebBrowser里的圖片 delphi

       sumstars 2014-11-19

      有一個Form1,里面有image1和webBrowser1,我用WebBrowser1連接到一個有驗證碼的網(wǎng)頁,想把里面的圖片提取到image1里,應(yīng)該怎么做?

      問題補充:

      我指的是圖片。例如:http://china.alibaba.com/member/join.htm驗證碼的地址是: http://checkcode.china.alibaba.com/service/checkcode?sessionID=e9EgR8RbEt2F8k68tQGjCKJ9NZnf8%24cS那里的圖片是每次都變化的。我需要的是把WebBrowser里顯示的驗證碼加載到TImage的對象里。下面的圖像如果看不清,就看這個鏈接:http://hiphotos.baidu.com/neek/pic/item/a4c5f0d3804a83fca9ec9ac3.jpeg 

      最佳答案:

      procedure DomImg2Image(src:string;wb:TWebBrowser;img:TImage);
      var
        i:Integer;
        rang:IHTMLControlRange;
      begin
        for i:=0 to IHTMLDocument2(wb.Document).images.length-1 do
          if Pos(src,(IHTMLDocument2(wb.Document).images.item(i,EmptyParam)as
            IHTMLElement).getAttribute('src',0))>0 then
          begin
            rang:=((IHTMLDocument2(wb.Document).body as HTMLBody).createControlRange)as
              IHTMLControlRange;
            rang.add(IHTMLDocument2(wb.Document).images.item(i,EmptyParam)as
              IHTMLControlElement);
            rang.execCommand('Copy',False,0);
            try img.Picture.Assign(ClipBoard)except end;
            break;
          end;
      end;
      procedure TForm1.WebBrowser1DocumentComplete(Sender:TObject;
      const pDisp:IDispatch;var URL:OleVariant);
      begin
        DomImg2Image('checkcode?',TWebBrowser(Sender),Image1);
      end;
      必須先uses ActiveX
      initialization
      OleInitialize(nil);
      finalization
      OleUninitialize;

      還要加一個單元文件 clipbrd 和 mshtml。

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多