I have a main gui thread that I want to remain responsive to the users action such as moving the dialog around, resizing, etc while I have a background thread doing some tas
You are not processing the incoming message of the UI thread, take a look at Raymond's blog (also see here) for a sample.
while (true) {
switch (MsgWaitForMultipleObjects(1, &h,
FALSE, INFINITE, QS_ALLINPUT)) {
case WAIT_OBJECT_0:
DoSomethingWith(h); // event has been signalled
break;
case WAIT_OBJECT_0+1:
// we have a message - peek and dispatch it
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
// TODO: must handle WM_QUIT; see Raymond's blog for details
TranslateMessage(&msg);
DispatchMessage(&msg);
}
break;
default:
return FALSE; // unexpected failure
}
}