Получать каптчу (картинку) не по ссылке, а из браузера -

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by scroyler, 10 Feb 2012.

  1. scroyler

    scroyler Banned

    Joined:
    23 Oct 2011
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    Всем привет есть код


    Code:
    uses
      ExtCtrls, mshtml, OleCtrls, ClipBrd, SHDocVw, WinInet, shellapi, URLMon,
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls,JPEG;
    
    type
      TForm1 = class(TForm)
        WebBrowser1: TWebBrowser;
        Memo1: TMemo;
        Button1: TButton;
        Button2: TButton;
        Image1: TImage;
        procedure Button1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure Button2Click(Sender: TObject);
    
         type
      IHTMLElementRender = interface(IUnknown)
        ['{3050F669-98B5-11CF-BB82-00AA00BDCE0B}']
        function DrawToDC
          ( _hDC:                      HDC
          ): HResult; stdcall;
      end;
    
    
    
    
    
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    function DownloadFile(SourceFile, DestFile: string): Boolean;
    begin
      try
        Result := UrlDownloadToFile(nil, PChar(SourceFile), PChar(DestFile), 0, nil) = 0;
      except
        Result := False;
      end;
    end;
    
    
    
    
    procedure TForm1.Button1Click(Sender: TObject);
    const
      // URL Location
      SourceFile = 'ссылка на нужную картинку';
      // Where to save the file
      DestFile = 'c:\temp\капча.gif';
    begin
      if DownloadFile(SourceFile, DestFile) then
      begin
        ShowMessage('Download succesful!');
      end
      else
        ShowMessage('Error while downloading ' + SourceFile)
    end;

    он выдерает капчу с ссылки,а как сделать так что бы он выдерал эту картинку сразу с браузера, а то капча меняется и картинки не соответствуют друг другу(

    или дайте плз рабочий код. Нужно выдать каптчу из веббраузера дельфийского
     
  2. fuckyoupig

    fuckyoupig Member

    Joined:
    1 Mar 2011
    Messages:
    0
    Likes Received:
    11
    Reputations:
    2
    Используй кукименеджер и картики меняться не будут.
     
  3. scroyler

    scroyler Banned

    Joined:
    23 Oct 2011
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    таак..а можно поподробней?
     
  4. scroyler

    scroyler Banned

    Joined:
    23 Oct 2011
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    Подскажите плзз... очень надо!
     
  5. patcher

    patcher Banned

    Joined:
    15 Dec 2009
    Messages:
    190
    Likes Received:
    37
    Reputations:
    10
    http://www.delphisources.ru/forum/showthread.php?t=13824
     
  6. scroyler

    scroyler Banned

    Joined:
    23 Oct 2011
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    Спасибо конечно, но я не понял.
    Как там указать сайт,название или путь к картинке, как вызвать эту функцию...
    можешь объяснить?
     
  7. scroyler

    scroyler Banned

    Joined:
    23 Oct 2011
    Messages:
    24
    Likes Received:
    0
    Reputations:
    0
    а все сам разобрался, большое спасибо!