TMyThread=class(TThread) //查询线程
private
FTimer:TTimer;
FThread:TThread;
FLabel:TLabel;
Fprobar:Tprogressbar;
procedure updateform;
procedure Terminateother(AThread:TThread);
protected
procedure execute;override;
public
constructor create(ATimer:TTimer;Alabel:Tlabel;AThread:TThread;Abar:TProgressbar);overload;
end;
TupThread=class(TThread) //更新进度条进程
private
count,position:integer;
FLabel:Tlabel;
FTimer:Ttimer;
FProbar:TProgressBar;
protected
procedure execute;override;
public
constructor create(ATimer:Ttimer;ALabel:Tlabel;AProbar:TProgressbar);overload;//cancel Atimer
procedure updateform;
end;
procedure TupThread.updateform;
begin
if FLabel.Caption<> '正在....' then
begin
FLabel.Caption:='正在....';
Flabel.Refresh ;
end;
if Fprobar.Position=Fprobar.Max then
Fprobar.Position:=0;
Fprobar.Position:=Position div 400;
end;
procedure TmyThread.execute;
var registry:TRegistry;
filename:string;
mappath:string;
temppath:string;
bakfilename:string;
substr:string;
begin
{查询}
// synchronize(updateform);
Terminateother(FThread);
Terminate;
end;
upthread:=TupThread.create(timer1,label1,progressbar1);
mythread:=TMyTHREAD.create(timer1,label1,upthread,progressbar1);