主要思想是这样的:
1.设置一个timer,通过ontimer让它0.5秒使全局变量IsContinue加1;
2.添加getTimer()函数,函数体为一句代码“result:=IsContinue”,即获得IsContinue的当前值;
3.在一个循环中加入如下代码,用来是循环停止在这一步,知道满足条件跳出该循环。
for .....
begin
while l=1 do
if curTimer=getTimer() then
begin
curTimer:=curTimer+1;
break;
end;
.....
4.其中的curTimer(局部变量),用它来判断是否跳出该循环。运行结果是程序死在那里不动了,一直在执行该循环。请问大家应该怎么做啊?如果上面的思想错了,请大家帮帮忙给个方案啊!在做课程设计要一个分步掩饰的效果不知道该怎么办,这里一直过不去。555555555555555
1.设置一个timer,通过ontimer让它0.5秒使全局变量IsContinue加1;
2.添加getTimer()函数,函数体为一句代码“result:=IsContinue”,即获得IsContinue的当前值;
3.在一个循环中加入如下代码,用来是循环停止在这一步,知道满足条件跳出该循环。
for .....
begin
while l=1 do
if curTimer=getTimer() then
begin
curTimer:=curTimer+1;
break;
end;
.....
4.其中的curTimer(局部变量),用它来判断是否跳出该循环。运行结果是程序死在那里不动了,一直在执行该循环。请问大家应该怎么做啊?如果上面的思想错了,请大家帮帮忙给个方案啊!在做课程设计要一个分步掩饰的效果不知道该怎么办,这里一直过不去。555555555555555
或用线程来做
procedure Delay(msec:integer);//延时函数,msec 为微秒(千分之1秒)
var
FirstTickCount : real;
begin
FirstTickCount := GetTickCount();
FirstTickCount := FirstTickCount + msec; While FirstTickCount > GetTickCount() do
Application.HandleMessage; end; delay (500); // 延时 0.5 秒改改应该可以用的
Application.ProcessMessage;这个加在哪里了?谢谢
对啊!就是想让一个2重循环里面得代码每隔0.5秒执行一次!
请问要把“延时函数”加在哪里?或者是怎么修改了?
不胜感激啊!
thanks a lot
begin
while l=1 do
if curTimer=getTimer() then
begin
Application.ProcessMessage;//加在这里让它可以处理外部消息 curTimer:=curTimer+1;
break;
end;
.....其实按照我的理解,实现你的需求,使用GetTickCount()就可以了。
O是新人啊,请指教:"GetTickCount()"谢谢啊!!!
ParametersThis function has no parameters. Return ValuesIf the function succeeds, the return value is the number of milliseconds that have elapsed since Windows was started.