A
AI_Player
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
MyThread = class(TThread)
private
{ Private declarations }
i:integer;
public
constructor Create(ord:integer);
protected
procedure Execute;
override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
constructor MyThread.Create(ord:integer);
begin
inherited Create(false);
i:=ord;
FreeOnTerminate:=true;
end;
procedure MyThread.Execute;
begin
{ Place thread code here }
showmessage(inttostr(i));
end;
procedure TForm1.Button1Click(Sender: TObject);
var j:integer;
begin
for j:=1 to 10do
MyThread.Create(j);
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
MyThread = class(TThread)
private
{ Private declarations }
i:integer;
public
constructor Create(ord:integer);
protected
procedure Execute;
override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
constructor MyThread.Create(ord:integer);
begin
inherited Create(false);
i:=ord;
FreeOnTerminate:=true;
end;
procedure MyThread.Execute;
begin
{ Place thread code here }
showmessage(inttostr(i));
end;
procedure TForm1.Button1Click(Sender: TObject);
var j:integer;
begin
for j:=1 to 10do
MyThread.Create(j);
end;
end.