Having DispatchMessage() in the loop could cause the slow down of do_some_action() depending upon the processing of the message. As this seems to be to play some animation, this could cause stuttering etc. The better solution is to have do-some_action() in its own thread with the main thread handling the gui interface. I suggest you look again at the multi-threaded solution. Once you get to understand threads, it's not all that confusing and has a lot of advantages.