21.11.2010, 09:47
Let Me Show You
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
http://data.cod.ru/75816
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP;
type
TGoThread = class(TThread)
private
FURL: String;
FMemo: TMemo;
FRes: String;
procedure Updt;
protected
procedure Execute; override;
public
constructor Create(AURL: String; AMemo: TMemo);
end;
TForm1 = class(TForm)
Memo1: TMemo;
Memo2: TMemo;
Memo3: TMemo;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TGoThread }
constructor TGoThread.Create(AURL: String; AMemo: TMemo);
begin
inherited Create(True);
FURL:=AURL;
FMemo:=AMemo;
FRes:='';
Resume;
end;
procedure TGoThread.Execute;
var
IdHTTP: TIdHTTP;
begin
IdHTTP:=TIdHTTP.Create(Form1);
try
try
FRes:=IdHTTP.Get(FURL);
except
FRes:='Exception: '+Exception(ExceptObject).Message;
end;
Synchronize(Updt);
finally
IdHTTP.Free;
end;
end;
procedure TGoThread.Updt;
begin
FMemo.Text:=FRes;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
TGoThread.Create(Edit1.Text, Memo1);
TGoThread.Create(Edit2.Text, Memo2);
TGoThread.Create(Edit3.Text, Memo3);
end;
end.
__________________
Пишу программы за еду.
__________________