有關Delay的方式 |
|
tailen
中階會員 發表:82 回覆:109 積分:63 註冊:2002-04-08 發送簡訊給我 |
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
用 Sleep 這個函式吧!
或參考 Delphi 的這篇 FAQ:
Article #15830: Creating a delay without a timer.
Question and Answer Database
FAQ830D.txt Creating a delay without a timer.
Category :Windows API
Platform :All
Product :All 32 bit
Question:
How do I create a delay without using a TTimer component,
and without locking up the system?
Answer:
Here is an example of using a loop that checks the time and
calls Application.ProcessMessages to allow Windows messages
to be processed during the loops execution.
procedure Delay(ms : longint);
var
TheTime : LongInt;
begin
TheTime := GetTickCount ms;
while GetTickCount < TheTime do
Application.ProcessMessages;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('Start Test');
Delay(2000);
ShowMessage('End Test');
end;
7/16/98 4:31:28 PM
Last Modified: 01-SEP-99 發表人 - hagar 於 2002/05/03 17:09:41
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |