我是这样做的
  t:=TmemoryStream.Create;
  s:='';
idhttp1.Get('验证码地址',t);     
application.ProcessMessages;
s:=GetTmpFileName(true,'~~','.bmp');
t.SaveToFile(s);
image.Picture.Bitmap.LoadFromFile(s)
可为什么我下载的验证码跟用
WebBrowser1
显示的网页里的验证码不一样??谢谢各位大虾!!!!!

解决方案 »

  1.   

    验证码是随机的,你Get一次就相当于刷新一次,当然不一样了。
      

  2.   

    1.通过URLDownloadToFile/URLDownloadToCacheFile去下载图片,如果在本地缓存能够找到图片它们会自动使用本地缓存内容,否则才去服务器上下载。2.使用GetUrlCacheEntryInfo或者FindFirstUrlCacheEntry/FindNextUrlCacheEntry这些API可以通过URL直接查找到缓存项。3.为图片元素调用浏览器复制命令(ControlRange.ExecCommand ("Copy")),然后从剪切板获取图片数据现在临时文件是找不到了,想用第三种方法,请问谁能给个例子哈.
      

  3.   

    procedure TForm1.Button2Click(Sender: TObject);
    var   
      d2,D:IHTMLDocument2;
      d1:IHTMLDocument;
      e:IHTMLElement;
      e2:IHTMLElement2;
      cp:IHTMLControlRange;
      img,img1:IHTMLImgElement;
      ce:IHTMLControlElement;
      myitem:Olevariant;
      i:integer;
    begin     D:=   webbrowser1.Document as IHTMLDocument2;
      e:=d.body as IHTMLElement;
      e2:=e as IHTMLElement2;
      cp:=e2.createControlRange as IHTMLControlRange;
      d2:= webbrowser1.Document as IHTMLDocument2;
      myitem := WebBrowser1.Document;
        for i := 0 to D.images.length - 1 do
        begin 
               img1:=D.all.item(i,varempty) as IHTMLImgElement;
               if  img1.src='images/buttom_01_01.jpg'  then
               img:=img1 AS IHTMLImgElement;
               begin
               end;   
        end;
    //  Clipboard.Assign(img as IHTMLImgElement);
     // img:=d2.images.item('images/buttom_01_01.jpg',0) AS IHTMLImgElement;
      ce:=img as IHTMLControlElement;
      cp.add(ce);
      cp.execCommand('Copy',false,0);
    end;初始化如下   
      initialization   
      OleInitialize(nil);   
      finalization   
      OleUninitialize;//end.前面。   
      在uses中加入ActiveX
    ============================================不过运行时提示interface not supported ...不知道什么原因,,,急
      

  4.   

    呵呵,那是,,,问题解决了,在WebBrowser先到剪贴板,再出来,谢谢各位的热情