Click to See Complete Forum and Search --> : Sleep or SleepEx
Just N Time
April 8th, 1999, 11:04 AM
trying to get a dialog based app ( vc++5) to pause for a set ammount of time ( pause for 60 secs.. then do something..)
and i use 'SleepEx(60000);' and get an error.I was told to use 'DWORD SleepEx(60000);' and no pause takes effect... any thing else I can use?
Code_Monkey
March 12th, 2005, 05:48 PM
If you intend on using SleepEx, I would suggest setting the second argument of the SleepEx function (BOOL bAlertable) to FALSE to guarantee that the function willl not return until the time-out period has elapsed; however, I would imagine that the traditional Sleep function would work for most general purposes.
darwen
March 12th, 2005, 06:34 PM
Why do you want your user interface to pause for a minute ?
As a guess you're using threads... and assuming that a thread will finish after
a minute has gone by.
Anyway, use Sleep instead of SleepEx. This'll have the desired effect.
Darwen.
JohnCz
March 13th, 2005, 01:42 PM
If you are using Sleep in a main thread, all window message processing including GUI update will be freeze.
After trying to press button for couple of times while timeout is in effect, user may just call Task Manager and kill process thinking window hung.
If you do it trying to synchronize threads, Sleep is not a good idea; use Event or Mutex or any thread synchronization method.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.