Yes, that is better. Keep in mind that processmessages drains the queue with messages empty anyway. So each iteration processes new messages.
Of course it is wise to avoids these kinds of constructs as much as possible, since they are essentially a band-aid for flaws else where. I had to rip something similar completely from the active parts of my apps since when the application was busy, the codepaths became totally unpredictable. I now only use it during startup and shutdown. (when the main event sources that make the application busy either haven't started yet, or have been signaled to terminate)