zoukankan      html  css  js  c++  java
  • Delphi Delay 延时计数的功能。 下面的方法都是思路,但是没有用在项目上

    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;

  • 相关阅读:
    ggplot2|theme主题设置,详解绘图优化-“精雕细琢”-
    ggplot2|theme主题设置,详解绘图优化-“精雕细琢”
    阻抗设计01
    Geber文件,装配图,BOM表的输出
    c语言里面你不知道的break与switch,contiune的用法
    数据结构之链表学习01
    数据结构概念及连续存储数组的算法演示
    使用malloc和free函数进行内存动态分配
    浅谈结构体
    浅谈指针01
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/5699029.html
Copyright © 2011-2022 走看看