给你一个停止线程的例子
interface
type
Txyz = class(TThread)
published
procedure Execute;
override;
end;
var
XYZThread: Txyz;
implementation
procedure Txyz.Execute;
begin
while Truedo
Application.ProcessMessages;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
XYZThread := Txyz.Create(False);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
XYZThread2.Suspend;
XYZThread2.Free;
end;
end.