
26.03.2013, 10:02
|
 |
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TMyThread = class(TThread)
private
param1: String;
param2: String;
param3: String;
param4: Integer;
param5: Integer;
rslt: String;
protected
procedure Execute; override;
public
constructor Create(aparam1, aparam2, aparam3: String; aparam4,
aparam5: Integer);
destructor Destroy; override;
end;
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
MyThread: TMyThread;
procedure OnThread(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TMyThread }
constructor TMyThread.Create(aparam1, aparam2, aparam3: String; aparam4,
aparam5: Integer);
begin
inherited Create(True);
FreeOnTerminate:=True;
param1:=aparam1;
param2:=aparam2;
param3:=aparam3;
param4:=aparam4;
param5:=aparam5;
Resume;
end;
destructor TMyThread.Destroy;
begin
windows.Beep(1000, 100);
inherited Destroy;
end;
procedure TMyThread.Execute;
begin
Sleep(1000);
rslt:=param1+param2+param3+IntToStr(param4+param5);
end;
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
MyThread:=TMyThread.Create('a', 'b', 'c', 1, 2);
MyThread.OnTerminate:=OnThread;
end;
procedure TForm1.OnThread(Sender: TObject);
begin
Caption:=MyThread.rslt;
end;
end.
__________________
Пишу программы за еду.
__________________
|