sleep函数是个阻塞函数,不阻塞的函数(延迟n秒)可以这样实现:
procedure mydelay(n:integer);
var begin
_time,end_time:integer;
begin
begin
_time:=gettickcount;
end_time:=gettickcount;
while ((end_time-begin
_time) div 1000) < n do
begin
Application.ProcessMessages;
end_time:=gettickcount;
end;
end;