在此提问,你应该知道使用多线程的方法。
type
MyThread = class(TThread)
private
{ Private declarations }
FProgress: Integer;
procedure CreateAndShowProgressWin;
procedure UpdateProgressWin;
procedure FreeProgressWin;
protected
procedure Execute;
override;
end;
implementation
{ MyThread }
procedure MyThread.CreateAndShowProgressWin;
begin
...
end;
procedure UpdateProgressWin;
begin
...
end;
procedure FreeProgressWin;
begin
...
end;
procedure MyThread.Execute;
begin
FProgress := 0;
Synchronize(CreateAndShowProgressWin);
try
for ...
begin
...
Inc(FProgress);
Synchronize(UpdateProgressWin);
end;
finally
Synchronize(FreeProgressWin);
end;
end;