I want an app to fire up another app in a modal fashion. Ie suspend itself until the 2nd app has returned.
Calling CreateProcess and waiting for it to finish works fine but no WM_PAINT messages get through so if you move the front window around the background app behind does not get redrawn. This is ugly if not confusing to the user.
So I created a message loop to handle messages while waiting for the 2nd app to terminate. If I process all messages the user can accidentally click the background app while the 2nd app is still running which is confusing and causes other problems. (See code below.)
If I process WM_PAINT and ignore all others the user can still click on the "disabled" app but can't do anything. This also is confusing to the user.
I really want it so that the background app handles WM_PAINT and other messages (eg automation) but if the user tries to interact with the background app then control returns to the 2nd app.
startupInfo.cb = sizeof(startupInfo);
BOOL fin = FALSE;
FALSE, INFINITE, QS_ALLINPUT))
case WAIT_OBJECT_0 + 0:
fin = TRUE;
case WAIT_OBJECT_0 + 1:
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
if (msg.message == WM_QUIT)
fin = TRUE;
// We need better message handling?