
09.12.2010, 19:38
|
 |
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
unit Unit1;
interface
uses
IdHTTP,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TGetThread = class(TThread)
private
FURL: String;
FRes: String;
procedure Updt;
protected
procedure Execute; override;
public
constructor Create(AURL: String);
end;
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
c: Integer;
implementation
{$R *.dfm}
{ TGetThread }
constructor TGetThread.Create(AURL: String);
begin
inherited Create(True);
FURL:=AURL;
Resume;
end;
procedure TGetThread.Execute;
var
http: TIdHTTP;
begin
try
http:=TIdHTTP.Create(nil);
try
FRes:=http.Get(FURL);
Synchronize(Updt);
finally
http.Free;
end;
except
end;
end;
procedure TGetThread.Updt;
begin
Form1.Memo2.Lines.Add(FRes);
Form1.Memo2.Lines.Add('--------------------------------------------------');
Dec(c);
if c=0 then ShowMessage('ok');
end;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin
c:=Memo1.Lines.Count;
for i:=0 to c-1 do
TGetThread.Create(Memo1.Lines[i]);
end;
end.
http://data.cod.ru/79019
__________________
Пишу программы за еду.
__________________
|