delphi取代Sleep的延时代码


本文整理自网络,侵删。

 delphi取代Sleep的延时代码

procedure Delay(msecs:integer);
var
Tick: DWord;
Event: THandle;
begin
Event := CreateEvent(nil, False, False, nil);
try
Tick := GetTickCount + DWord(msecs);
while (msecs > 0) and (MsgWaitForMultipleObjects(1, Event, False, msecs, QS_ALLINPUT) <> WAIT_TIMEOUT) do
begin
Application.ProcessMessages;
msecs := Tick - GetTickcount;
end;
finally
CloseHandle(Event);
end;
end;

相关阅读 >>

Delphi 在win32程序中显示dos调试窗口

Delphi xe5 android 捕获几个事件

Delphi 在窗口作图的源代码

Delphi 2009 之 tballoonhint

Delphi winapi: settimer、killtimer - 创建与移除高性能定时器

Delphi日期函数、日期加减

Delphi在64位系统下读写注册表

建议大家使用fastmm

Delphi webbrowser控件属性

Delphi格式化wmi中的datetime

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



打赏

取消

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

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

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

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

评论

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

    正在狠努力加载,请稍候...