等待函數(界面保持響應正常)不同於Sleep

等待函數(界面保持響應正常)不同於Sleep


// 自定義函數

procedure WaitTime(MSecs: integer);
var
  FirstTickCount, Now: Longint;
begin
  FirstTickCount := Windows.GetTickCount();
  repeat
    Application.ProcessMessages;
    Now := Windows.GetTickCount();
  until
    (Now - FirstTickCount >= MSecs) or (Now < FirstTickCount);
end;



Eg: WaitTime(1000);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章