I need to close a whole "stack" of windows when a stimulus occurs at the top level. The Windows Owner/Owned relationship will destroy an owned window when the owner is destroyed, but this will not cause EndDialog to run (or, more importantly, EndModalLoop). So, after the window is destroyed, the app is still (at some level of the call stack), running in RunModalLoop and when the app returns there, the call to ContinueModal still returns TRUE (because EndModalLoop has yet to run).
I need to fix this for a number of cases in the application, and it would be cumbersome to add a special handler (say, OnDestroy) to every class or to interpose a special MyAppCDialog class with this handler in the class hierarchy.
What can I do to get EndDialog or EndModalLoop to run?