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;
|
请发表评论