Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
先声明 Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)然后在你要停住的语句上加上这个语句: call sleep 5000 '5000 单位是毫秒 也就是 5秒
写个过程给你: Private Declare Function timeGetTime Lib "winmm.dll" () As LongSub Delay(Byval DelayTime As Long) '单位是毫秒 DelayTime =DelayTime + Timegettime Do While Timegettime < DelayTime DoEvents Loop End Sub调用的时候这样写: ... Delay 1000 '延时一秒 ...用这个过程比较好,不会造成程序“假死”的现象。
上面的兄弟,我试了一下,可是结果是Timegettime的值是空值,结果是程序在死循环。 Do while Timegettime < DelayTime DoEvents Loop 程序就是在这个循环语句中执行,请求帮助,谢谢!!!!
'这是延迟函数. Public Sub Delay(PauseTime As Single) Dim Start As Single Start = Timer ' 设置开始暂停的时刻。 Do While Timer < Start + PauseTime DoEvents ' 将控制让给其他程序。 Loop End Sub'调用就 ...... Delay 3000'三秒 ....
...
sleep 5000
在时钟控件的程序中定义你要执行的程序!(时钟控件的interval设成5000)
Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)然后在你要停住的语句上加上这个语句:
call sleep 5000 '5000 单位是毫秒 也就是 5秒
Private Declare Function timeGetTime Lib "winmm.dll" () As LongSub Delay(Byval DelayTime As Long) '单位是毫秒
DelayTime =DelayTime + Timegettime
Do While Timegettime < DelayTime
DoEvents
Loop
End Sub调用的时候这样写:
...
Delay 1000 '延时一秒
...用这个过程比较好,不会造成程序“假死”的现象。
Do while Timegettime < DelayTime
DoEvents
Loop
程序就是在这个循环语句中执行,请求帮助,谢谢!!!!
Public Sub Delay(PauseTime As Single)
Dim Start As Single
Start = Timer ' 设置开始暂停的时刻。
Do While Timer < Start + PauseTime
DoEvents ' 将控制让给其他程序。
Loop
End Sub'调用就
......
Delay 3000'三秒
....