贴一个最简单的给你,unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
aThread = class(TThread)
private
{ Private declarations }
protected
procedure Execute;
override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
ccc : aThread;
begin
ccc := aThread.Create(false);
ccc.Resume;
end;
{ aThread }
procedure aThread.Execute;
var
i, j : Integer;
begin
j := 0;
for i := 1 to 100do
begin
j := j + i;
end;
Form1.Edit1.Text := IntToStr(j);
end;
end.