Sleep crash application

Is there a way to use Sleep() on a graphic application withou crashing it?
I created a macro function that change to an other window and execute some functions, but when i tried to put it with the graphic interface, it works, but the macro have a lot of Sleep functions, and if i try to back to the interface it crash.
Someone could help me?
Sleep() does not crash the program. It will freeze the gui because a gui is event driven and no more events are received/processed.
And do you know any function that executes the gui parallel to the "sleep"?
You need a parallel thread:

http://www.cplusplus.com/reference/thread/thread/?kw=thread

You need to call a thread safe update function for the gui, otherwise you will not see any changes.

Note that only particularly thread safe functions can be called from a parallel thread.
Topic archived. No new replies allowed.