我用了一下方法延时10秒procedure TForm1.Delay(); var
NumSec:SmallInt;
StartTime:LongInt;
begin
StartTime:= GetTickCount;
repeat
Application.ProcessMessages;
Sleep(1);//能解决CPU100%的问题
until GetTickCount>StartTime+10000;
end;
程序出现Application.Terminate;不响应,别的语句是会响应的,求解?
NumSec:SmallInt;
StartTime:LongInt;
begin
StartTime:= GetTickCount;
repeat
Application.ProcessMessages;
Sleep(1);//能解决CPU100%的问题
until GetTickCount>StartTime+10000;
end;
程序出现Application.Terminate;不响应,别的语句是会响应的,求解?
procedure TForm1.Delay(); var
NumSec:SmallInt;
StartTime:LongInt;
begin
StartTime:= GetTickCount;
repeat
Application.ProcessMessages;
Sleep(10);//能解决CPU100%的问题
until (GetTickCount>StartTime+10000) or Application.Terminated;
end;
Application的Terminate来终止程序的,Close、FormCloseQuery、Halt 都将不会执行,
不会响应你的代码。