Solved

how to close all open dialogs programmatically?

Posted on 2001-07-02
4
405 Views
Last Modified: 2013-11-20
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
Comment
Question by:pratimag
  • 2
4 Comments
 
LVL 2

Expert Comment

by:MadYugoslav
ID: 6247482
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
 

Author Comment

by:pratimag
ID: 6247522
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
 
LVL 2

Expert Comment

by:MadYugoslav
ID: 6247543
Can You describe is it Dialog/MDI or SDI application ?
0
 
LVL 2

Accepted Solution

by:
GloriousRain earned 100 total points
ID: 6247551
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
lucky13 challenge 11 112
either24  challenge 19 84
abstract class with all non abstract mentods 6 72
MaxSpan challenge 9 67
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now