Solved

how to close all open dialogs programmatically?

Posted on 2001-07-02
4
409 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

929 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

9 Experts available now in Live!

Get 1:1 Help Now