加入线程单元
unit MyThreadUnit
type
MyThread = class(TThread)
protected
...
procedure Execute;
override;
public
...
Finished: Boolean;
end;
procedure TMyThread.Execute;
begin
//你的执行代码
Finished:=true;
end;
end.
在主窗体加入此过程
procedure ExeThread();
var
aThread: TMyThread;
begin
aThread := TMyThread.Create(False);
while (not AnalyseThread.Finished)do
begin
Application.ProcessMessages;
Sleep(10);//可调整
end;
end;