delphi真正实现延时暂停功能


本文整理自网络,侵删。

 用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);//延时一秒

出处:http://www.ppblog.cn/delay.html

相关阅读 >>

Delphi 系统服务和普通forms程序共存一体的实现

Delphi 全局钩子锁定鼠标

Delphi 生成日志记录单元

Delphi waitforsingleobject 响应窗体

Delphi中关于canvas.textout的用法

Delphi 回车 选择下一个控件

Delphi 动态加载删除字体

Delphi searchrec.attr and fadirectory

Delphi dll 字符串传递例子

Delphi 字幕下载单元subdownload.pas

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...