Z zzd Unregistered / Unconfirmed GUEST, unregistred user! 1999-10-28 #1 我想将一窗体隐藏,但在隐藏之前,我想让它显示一段时间,<br>也就是在显示该窗体后,使程序暂停一段时间,请问有没有<br>这样的函数,若没有请教其他的方法。
小 小天 Unregistered / Unconfirmed GUEST, unregistred user! 1999-10-28 #5 var numsec:smallint;<br> starttime:TTime;<br>begin<br> ...<br> starttime:=now;<br> numsec:=5; //5 秒<br> repeat<br> application.processmessage;<br> until now>starttime+numsec*(1/24/60/60);<br> ...<br>end;<br>
var numsec:smallint;<br> starttime:TTime;<br>begin<br> ...<br> starttime:=now;<br> numsec:=5; //5 秒<br> repeat<br> application.processmessage;<br> until now>starttime+numsec*(1/24/60/60);<br> ...<br>end;<br>
C cytown Unregistered / Unconfirmed GUEST, unregistred user! 1999-10-28 #7 小天的程序有问题:<br>如果在5秒内改了系统时间<br>sleep最省事了
W wrench Unregistered / Unconfirmed GUEST, unregistred user! 1999-10-28 #8 VOID Sleep<br>(<br> DWORD dwMilliseconds // sleep time in milliseconds <br> <br>这是一个API,参数的单位为千分之一秒<br> <br><br>
VOID Sleep<br>(<br> DWORD dwMilliseconds // sleep time in milliseconds <br> <br>这是一个API,参数的单位为千分之一秒<br> <br><br>
S sunstone Unregistered / Unconfirmed GUEST, unregistred user! 1999-10-28 #9 如果作程序的封皮,可以这样做<br>Uses AboutBox<br>Var <br>lTime :TDateTime;<br>Begin<br>Application.Initialize(); <br>AboutBox=TAboutBox.Create(AboutBox); <br>AboutBox.Show; <br>AboutBox.Update; <br>lTime=GetTickCount; <br>Application.CreateForm(TMainForm,MainForm); <br>while((GetTickCount-lTime) / 1000 <3) do; //如果mainform创建的时间很短<br> 也可延长总计3秒的时间<br>AboutBox.Hide; <br>AboutBox.Free;<br>Application.Run; <br>end; <br>用sleep 不能保证总长3秒
如果作程序的封皮,可以这样做<br>Uses AboutBox<br>Var <br>lTime :TDateTime;<br>Begin<br>Application.Initialize(); <br>AboutBox=TAboutBox.Create(AboutBox); <br>AboutBox.Show; <br>AboutBox.Update; <br>lTime=GetTickCount; <br>Application.CreateForm(TMainForm,MainForm); <br>while((GetTickCount-lTime) / 1000 <3) do; //如果mainform创建的时间很短<br> 也可延长总计3秒的时间<br>AboutBox.Hide; <br>AboutBox.Free;<br>Application.Run; <br>end; <br>用sleep 不能保证总长3秒
S suman Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-04 #10 使用sleep的话, 程序这段时间内将会停止响应, 用for循环也可以,但是机器速度不同, 暂停的时间差别很大的
L liuchuanbo Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-04 #11 timer1.interval:=3000;<br> i:=1;<br>ontimer;<br>begin<br> if i:>=3 then<br> timer1.enabled:=false<br> else<br> i:=i+1;<br><br>end;
timer1.interval:=3000;<br> i:=1;<br>ontimer;<br>begin<br> if i:>=3 then<br> timer1.enabled:=false<br> else<br> i:=i+1;<br><br>end;
唐 唐晓锋 Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-05 #12 procedure Delay(MilliSeconds: dword);<br>var <br> Event : THandle;<br>begin <br> Event := CreateEvent(nil,True,False,nil);<br> WaitForSingleObect(Event,MilliSeconds);<br> CloseHandle(Event);<br>end;
procedure Delay(MilliSeconds: dword);<br>var <br> Event : THandle;<br>begin <br> Event := CreateEvent(nil,True,False,nil);<br> WaitForSingleObect(Event,MilliSeconds);<br> CloseHandle(Event);<br>end;