W
ww20000309
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
tmythread=class(tthread)
private
flabel:tlabel;
procedure addcount;
protected
procedure execute;override;
public
constructor create(mylabel:tlabel);virtual;
end;
var
Form1: TForm1;
count:tmythread;
implementation
{$R *.dfm}
procedure tmythread.addcount ;
var
i:integer;
begin
for i:=1 to 1000do
flabel.Caption:=flabel.Caption+inttostr(i);
end;
procedure tmythread.execute ;
begin
addcount;
end;
constructor tmythread.create(mylabel:tlabel);
begin
flabel:=mylabel;
inherited create(true);
freeonterminate:=false;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
count.create(label1);
count.execute ;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
tmythread=class(tthread)
private
flabel:tlabel;
procedure addcount;
protected
procedure execute;override;
public
constructor create(mylabel:tlabel);virtual;
end;
var
Form1: TForm1;
count:tmythread;
implementation
{$R *.dfm}
procedure tmythread.addcount ;
var
i:integer;
begin
for i:=1 to 1000do
flabel.Caption:=flabel.Caption+inttostr(i);
end;
procedure tmythread.execute ;
begin
addcount;
end;
constructor tmythread.create(mylabel:tlabel);
begin
flabel:=mylabel;
inherited create(true);
freeonterminate:=false;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
count.create(label1);
count.execute ;
end;
end.