• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

DelphiDelay延时计数的功能。下面的方法都是思路,但是没有用在项目上 ...

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

procedure Tfrm_InstrumentControl.aa;
var
CurLength: Word;
vTimeLength: Word;
begin
Screen.Cursor := crHourGlass;
try
vTimeLength := StrToIntDef(num_GrossAnalyzeTime.Text, 0) * 60;
CurLength := 0;
while CurLength < vTimeLength do
begin
if IsCanExcute(1000) then
begin
iSevenSegmentClock1.Seconds := CurLength;
Application.ProcessMessages;
end;
CurLength := CurLength + 1;
end;

finally
Screen.Cursor := crDefault;
end;
end;


procedure Tfrm_InstrumentControl.Delay111(msecs:integer);
var
Tick: DWord;
Event: THandle;
curTick: DWord;
begin
Event := CreateEvent(nil, False, False, nil);
try
Tick := GetTickcount + DWord(msecs);;
curTick := 0;
while (msecs > 0) and (MsgWaitForMultipleObjects(1, Event, False, msecs, QS_ALLINPUT) <> WAIT_TIMEOUT) do
begin
if (curTick mod 1000) = 0 then
begin
//iSevenSegmentClock1.Seconds := Trunc(curTick/1000);
// iSevenSegmentClock1.Hours := Trunc(curTick/(1000*60*24));
// iSevenSegmentClock1.Minutes := Trunc(curTick/(1000*60));
// iSevenSegmentClock1.Seconds := Trunc(curTick/(1000));
// iSevenSegmentClock1.SetTimeNoEvent(curTick);
iSevenSegmentClockSMPTE1.Time := curTick/(1000*60*60*24);
Application.ProcessMessages;
end;
inc(curTick);
msecs := Tick - GetTickcount;
end;
finally
CloseHandle(Event);
end;
end;


procedure Tfrm_InstrumentControl.Delay2(MaxWaitTime: Cardinal);
var
WaitedTime:Cardinal;
begin WaitedTime:=0; // while (WaitedTime<MaxWaitTime) do
// begin
// SleepEx(100,False);
// Inc(WaitedTime,1000);
// if (WaitedTime mod 1000) = 0 then
// iSevenSegmentClock1.Seconds := WaitedTime/1000;
// Application.ProcessMessages ;
// end;
end;


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
matlab绘制垂线(x轴或y轴)发布时间:2022-07-18
下一篇:
[Matlab] bsxfun函数用法发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap