Hi all,
My program shows a modal dialog box. From within this dialog box I want to
show a modeless dialog box when the user presses a button in the modal box
(that behaves independant from the modal dialog box). The goal is to have
the modeless dialog remain present when the modal dialog exits.
First try was to just show the dialog in my button handler, but then the
modeless dialog would be killed when the modal dialog would exit (even
without proper notification from WM_DESTROY etc). I presume this is because
the modeless dialog's messages got pumped by the modal box's pump, and on
termination of that pump, all subsequent messages get lost => exit modeless
dialog.
Second try was to let the modeless dialog have it's own separate message
pump in a separate thread, so it wouldn't intermingle with the modal box's
pump. So now, I start up a new thread in my button handler, and the thread
will Create the dialog and then pump the messages in this thread's own
message pump (that only scans for the correct HWND, by the way). Looks
cool, should work (at least a bit better than try # 1), but failed. This
time, the Create routine doesn't return untill the modal dialog is
terminated; after that, all continues as planned.
Of course I do not want the modeless dialog to appear after the user has
killed the modal dialog. Does anyone have any ideas as to how to solve this
problem? The stuff I'm working with is:
- Modeless dialog logic works on it's own when not triggered from the modal
dialog
- Modal dialog shown by DoModal method in class derived from ATL's
CDialogImpl
- Modal dialog ultimately operated by a call to DialogBoxParam
- Modeless dialog's message queue created before the call to Create with a
call to PeekMessage
- ATL out-of-process exe server (= another message pump present at global
level for COM stuff)
Thanks in advance,
Carl Colijn
Sidenote: my news provider (Chello from UPC) thinks 600TB of newgroup
binaries is more important than 100KB of other proper newsgroup posts =>
messages will stay on the news server for 1-2 day on average, so I might not
be able to respond to this post, or respond with great delay via Google...