创建threads:
然后将execute:
修改成你的执行函数:,注意threads安全!
如果想结束,将threads
; dcs = class(TThread)
; private
; ; gaugx:tgauge;
; ; { Private declarations }
; protected
; ; procedure Execute; override;
; public
; constructor create(gaug:tgauge);
; end;
constructor dcs.create(gaug:tgauge);
begin
gaugx:=gaug;
inherited create(false);
end;
procedure dcs.Execute;
var
i,j:integer;
begin
for i:=100000000 downto 0 do
; ; begin
; ; gaugx.Progress:=i;
; ; end;
gaugx.Progress:=10000000;
gaugx.hide;
end;
//执行threads下面一行
mythread2:=dcs.Create(gauge2);