unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdHTTP;

 

 


type
    TForm1 = class(TForm)
    Button1: TButton;
    IdHTTP1: TIdHTTP;
    procedure Button1Click(Sender: TObject);
  *******
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var s:TStringList;
    MStream:TMemoryStream;
    i:integer;

begin
  s:=TStringList.Create;
  s.Add('http://www.taomn.com/pic/bimg/albums/photos/1/0/1/101705/1139753842.jpg');
  s.Add('http://www.taomn.com/pic/bimg/albums/photos/1/0/1/101705/1139753793.jpg');
  s.Add('http://www.taomn.com/pic/bimg/albums/photos/1/0/1/101705/1139753782.jpg');
  for i:=0 to s.Count-1 do
    begin
      MStream:=TMemoryStream.Create;
      IdHttp1.Get(s[i],MStream);
      MStream.SaveToFile('c:\'+IntToStr(i)+'.jpg');
      MStream.Free;
    end;
  ShowMessage('下载完毕');
  s.Free;
end;
end.

IdHTTP的创建
{IdHTTP := TIdHTTP.Create(nil);
try
  IdHTTP.Get(URL, SavedStream);
finally
  IdHTTP.Free;
end;}

相关文章:

  • 2022-12-23
  • 2021-11-30
  • 2021-11-30
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2021-09-20
  • 2021-11-30
  • 2022-02-03
  • 2022-01-06
相关资源
相似解决方案