When initializing a modal dialog I have a long-running routine and I
wanted to run a modeless dialog which shows the progress of the
long-running routine from within the WM_INITDIALOG handler.
Is this possible ?
In the WM_INITDIALOG I used CreateDialogParam, got back the HWND, did a
ShowWindow, and subsequently within my long running initialization
routine did a PeekMessage loop just for messages for the modeless
dialog, like so:
while (PeekMessage(&msg, lwnd, 0, 0, PM_REMOVE))
// long running processing, and break when finished
where lwnd is the HWND for my modeless dialog. Then at the end of my
long-running initialization I did a SendMessage(lwnd,WM_CLOSE,0,0) and
in the modeless dialog's windows procedure it does a DestroyWindow when
it receives the WM_CLOSE message.
Unfortunately the modeless dialog never showed itself. I checked the
CreateDialogParam and it does return a valid HWND. The documentation for
the return from ShowWindow does not tell how I can determine whether it
is successful or not. Nevertheless the window never appears.
If I start the dialog as a modal dialog, it appears correctly, but of
course that's not what I want. Any ideas why the modeless dialog is not
appearing would be appreciated.
The application does not run a standard message loop since the main
window is a modal dialog. But I do not think that should affect my
ability to read the thread's message input queue for modeless dialog