Hi,
I have written the following ugly function. This appears to hog all processor power, so there must be a better way to sleep in a program for a period of time.
Does anyone have any suggestions?
Nice.
SD
I have written the following ugly function. This appears to hog all processor power, so there must be a better way to sleep in a program for a period of time.
Does anyone have any suggestions?
Code:
// Will sleep the program for given number of seconds
private void Sleep(int i_SleepSeconds)
{
// Locals
DateTime then;
then=DateTime.Now;
while(0==0)
{
TimeSpan ts=DateTime.Now - then;
if(ts.Seconds>i_SleepSeconds)
{
break; // out of while
}
// Process events
Application.DoEvents();
}
}
Nice.
SD