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;

  • 相关阅读:
    117. Populating Next Right Pointers in Each Node II
    50. Pow(x, n)
    494. Target Sum
    Word Ladder
    HDU 4417
    POJ 2104
    POJ 3277
    【转】图论500题
    POJ 2991
    POJ 1436
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/5699029.html
Copyright © 2011-2022 走看看