Thanks for your reply. I didn't know about the MsgWaitForMultipleObjects API. What I've done is create a thread in the error handler, pass it an event, have the thread create a dialog and, in the main thread, poll the event regularly. In the dialog thread the thread uses MsgWaitForMUltipleObjects to process messages while polling the event. If the user cancels the dialog thread sets the event. If the operation succeeds the main thread sets the event which the dialog thread then ends the dialog and thread.