App shutdown when Modal dialog is active
Serge Wautier -- serge.wautier@ontonet.be
Thursday, January 30, 1997
Environment: Visual C++ 4.1 / Windows 95
Hi All,
My App1 is an addon for App2. This means that App1 can run only when App2
is running (Actually, App2 starts App1). When App2 stops, App1 is notified
by App2 and shuts down as well.
Everything works fine except if App1 (Dialog-based MFC 4.1) has a modal
secondary dialog box opened when it is notified to shut down : The main
dialog closes correctly (and so disappears from the task bar) but the
process goes and the secondary dialog remains opened.
To solve this problem, i thought of having a flag set in the main dlg when
a secondary dlg is opened so that, upon shutdown, i know that i have to
EndDialog it. But i'm afraid that the EndDialog might fail for the same
reason if the secondary dialog has a third dialog opened,etc...
Having to keep track of all dialogs opened in cascade is of course feasible
but seems dirty and not very reliable (I've got a lot of dlgs and i might
forget some cases).
Does anyone have a hint about how to close all child dialogs easily and
safely.
Thanks in advance,
Serge Wautier,
Techno Trade s.a.
Belgium
serge.wautier@ontonet.be
http://www.tbox.fr
Doug Brubacher -- Doug_Brubacher@compuware.com
Tuesday, February 04, 1997
I have not tested this, however I think CWnd::GetLastActivePopup()
would prove useful.
If you do have to keep track of all windows manually I good solution
might be to implement a LIFO stack in your CWinApp derived object.
Any Dialog could add itself to the stack in its InitInstance and
remove itself from the stack in its DestroyWindow.
Regards,
Doug Brubacher
Doug_Brubacher@compuware.com
| Вернуться в корень Архива
|