• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Closing all windows

I am wrting an app using MFC in Microsoft Visual C++
My system is connected to an UPS unit sending a command to close windows when a power failure is detected (The DestroyWindow function is automatically activated).
It is working well when my main view is active.
But if a modal dialog box is open the system crashes.
I suppose that all ressources are not closed properly.
My question is :How from the main DestroyWindow function
can i close all opened modal dialog boxes ?

Best regards !!!

  • 2
1 Solution
Never tried it ;-)

.but call:

pMainWnd->SendMessageToDescendants( WM_DESTROY );

I hope that it will work!
marcelcohenAuthor Commented:
I try ot and it did'nt help.

Do you have to close all windows or to close the entire application?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now