Pausing the execution of code...
I have a code that I use to pause for given amount of time:
Sub Pause(interval)
Dim Current as Double
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub
Well, everything works perfect but the Do...Loop structure is CPU consuming and while the structure is executed, CPU is overloaded. I tried to use Sleep API, it works fine in my case also but when Sleep is executed, program is "frozen" so I can't control my program while Sleep API is executing. I was wondering if everyone knows any other way to "simulate" Pause of the program, but so it won't freeze my program and/or won't overload my CPU (Sleep API doesn't overload my CPU, so I was wondering if there's anyway to "unfreeze" my program while Sleep API is executing...just like DoEvents does in Loops)
Programs and requests for them for FREE.
http://falstok.fly.to
Re: Pausing the execution of code...
Do not know if this is the case, but if you need to wait for a signal, you can disable all controls on your form and have a timer active. In timer event you can test for conditions to enable controls again.
Hope this help.
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.