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

how to close all open dialogs programmatically?

In an application, on click of a particular menu option
1. All the dialogs that are opened should be closed  
   automatically.
2. There can be n number of dialogs open.
3. The open dialogs may me modal or modless.

How do I programmatically close all the open dialogs without exiting from the application?

0
pratimag
Asked:
pratimag
  • 2
1 Solution
 
MadYugoslavCommented:
The easy way is to track and remember somewhere all windows when create new one.
The other solution is to go through all child windows of your main window and check is it non child window and then You close it.
0
 
pratimagAuthor Commented:
The question I asked was totally different. To close all the open windows or documents or child windows there is a api function called CloseAllDocuments(). You can just call this function.

What I asked was, how to close the open DIALOGS and not any child windows.
Any clue to this prolem is also welcome.
0
 
MadYugoslavCommented:
Can You describe is it Dialog/MDI or SDI application ?
0
 
GloriousRainCommented:
I have 2 propose solutions for that:
1. Store every handle of opened dialog to an array. Whenever you want to close them, just call ::EndDialog(arrHandles[i], 1)
2. Create specific message then broadcast it when you want to close all dialog. In each dialog that you open have to process this message to exit itself.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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