A
aikede
Unregistered / Unconfirmed
GUEST, unregistred user!
下面的代码,我创建一个线程做运算,为什么,执行线程期间,还是无法相应VCL的主消息
?????迷惑
TMyThread = class(TThread)
private
protected
procedure Execute;override;
public
procedure TMyThread.Execute;
var
i:integer;
MyTemp:single;
begin
FreeOnTerminate:=true;
for i:=0 to 90000000do
begin
if Terminated then
Break;
MyTemp:=sqrt(sqrt(i));
end;
end;
procedure TForm1.Btn_TestClick(Sender: TObject);
var
TempThread:TMyThread;
begin
TempThread:=TMyThread.Create(false);
TempThread.Execute;
end;
?????迷惑
TMyThread = class(TThread)
private
protected
procedure Execute;override;
public
procedure TMyThread.Execute;
var
i:integer;
MyTemp:single;
begin
FreeOnTerminate:=true;
for i:=0 to 90000000do
begin
if Terminated then
Break;
MyTemp:=sqrt(sqrt(i));
end;
end;
procedure TForm1.Btn_TestClick(Sender: TObject);
var
TempThread:TMyThread;
begin
TempThread:=TMyThread.Create(false);
TempThread.Execute;
end;