Is there any way to process all Windows messages while the UI thread is waiting on a WaitHandle or other threading primitive?
I realize that it could create very messy reentrancy problems; I want to do it anyway.
EDIT: The wait occurs in the middle of a complicated function that must run on the UI thread. Therefore, moving the wait to a background thread is not an option. (Splitting the function in two would make a complicated and unmaintainable mess)