08-08-2006 11:58 AM
08-08-2006 03:53 PM
When you call sleep() from your main thread, it does just that, puts the thread to sleep for the period of time you specify. During that period your UI is blocked because the thread it uses to respond to UI events is sleeping. You have a lot of options:
You can put the routine that needs to sleep in another thread, this keeps the main UI thread from unblocked.
You can create a loop that uses the SDK function MsgWaitForMultipleObjectsEx() that allows your thread to sleep but to be awakened by some types of events.
You can create your own equivalent to the sleep routine that simply loops while calling ProcessSystemEvents() for the period that you are trying to sleep. ProcessSystemEvents() will unblock the UI Events.
You can design you system to be only event driven to avoid the need for a sleep routine.
If you can describe what you are trying to do we may be able to provide more input as to what may help.