Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wait process takes CPU usage to 100% Help?

Status
Not open for further replies.

chrispybee

Technical User
Joined
Jun 12, 2003
Messages
45
Location
GB
I have a wait routine that maxs out my CPU while it waits.

Is there another way of waiting #seconds without maxing out my cpu. I've tried the following.

Example 1:

Public Sub Wait(sec As Single)
Dim tim As Single
tim = Timer
While Timer < tim + sec
DoEvents
Wend
End Sub

Usage: wait 1' Wait 1 second

Example 2:

Sec = Second(Time) + 5
Do Until (Second(Time) >= Sec)
DoEvents
Loop

MsgBox "This is done.."
End

The problems that I have are the following...

1. Crashs application after 7 - 10 hours
2. CPU Usage is 100% when waiting

Any help would be great. I dont know how to use timers, so help on this would also be great.

Novice when comes to these sort of routines.
 
Take a look at this thread:

thread222-925158

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top