|
-
April 9th, 2001, 12:51 AM
#1
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
-
April 9th, 2001, 02:01 AM
#2
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.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|