用delphi怎么实现延时功能?在delphi中有一个sleep()函数是用来暂停线程的,使用了它好像和死掉了似得,不好用,这么简单的延时动作用Timer控件有显得复杂了。
下面给大家分享一个真正好用的延时功能:

procedure delay(MSecs:LongInt);
var
  FirstTickCount,Now:LongInt;
begin
  FirstTickCount:=GetTickCount();
  repeat
    Application.ProcessMessages;
    Now:=GetTickCount();
  until (Now - FirstTickCount >=MSecs)or(Now<FirstTickCount);
end;
//调用
delay(1000);//延时一秒

 

相关文章:

  • 2021-03-31
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-11-24
  • 2021-06-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-28
  • 2022-02-24
  • 2021-12-12
相关资源
相似解决方案