现在够明白了
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Treaddatathread = class(TThread)
private
b:integer;
protected
constructor Create();
procedure Execute;
override;
function gettest(text:integer):bool;
end;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
a:integer;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ Treaddatathread }
constructor Treaddatathread.Create;
begin
inherited create(true);
end;
procedure Treaddatathread.Execute;
begin
inherited;
end;
function Treaddatathread.gettest(text: integer): bool;
begin
b:=text;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
mythread : Treaddatathread;
begin
a:=1;
mythread:=Treaddatathread.Create;
mythread.gettest(a);
mythread.Resume;
end;
end.