|I have a technique that I use in WinAPI programs, to avoid stalling the message queue.
I start a separate thread in my program, which opens a hidden window with its own message queue. I typically call this thread the CommTask thread, since the first time I did this was to handle slow serial communications. When I want to perform a time-consuming task, I send a message to the CommTask thread using SendMessageCallback(), with a data packet telling it what to do.
When the CommTask thread completes handling of my message, my callback function gets executed.
What I don't know is, what thread is the callback function executing in?? Is it still in the CommTask thread, or has it somehow returned to my main program thread, or is there some other thread context that it executes in?