方案1:SecondsToWait单位"秒"
function Seconds( timConvert:TDateTime ): longint;
var
Hour, Min, Secs, MSecs, PrevSecs: word;
begin
DecodeTime( timConvert, Hour, Min, Secs, MSecs );
Result := ( Hour*60*60 )+( Min*60 )+Secs;
end;
procedure SecondsToWait( intSeconds: integer; bolProcessMessages: boolean );
var
lngStartSecs, lngElapsed: longint;
begin
lngStartSecs := Seconds(Now);
lngElapsed := 0;
while lngElapsed <= intSeconds do
begin
if bolProcessMessages then Application.ProcessMessages;
lngElapsed := Seconds(Now) - lngStartSecs;
end;
end;
方案2
elay单位"毫秒"
Procedure Delay(DTime : LongInt);
Var
L : LongInt;
Begin
L := GetTickCount;
While (Abs(L-GetTickCount) < DTime) do;
End;