By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,420 Members | 1,133 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,420 IT Pros & Developers. It's quick & easy.

VC++.Net, How to close an SDI application from a Dialog box?

P: 2
Hello,

I have a problem I have been dealing with for a couple of days now.. any help would be greatly appreciated.

I have an SDI Application that opens first with appearance of a Dialog box..

The Dialog DoModal code is located in the initialization application function of the main application code:

CStatusDlg dlg;
dlg.DoModal();

then the SDI Window opens after I close the Dialog box.. again, no big deal. That is the way it is supposed to.

My problem.. I want the Dialog box to have an optional CONTOL HANDLER (Exit Button) to close the ENTIRE Application (including the Dialog Box) and PREVENT the SDI Window from opening..

So far I have been able to close the application in the Event Handler function with the following code:

m_pMainWnd->DestoyWindow();

Here I am using a Global pointer (variable) to effectively close everything..

THE PROBLEM.. upon execution the program throws an exception..

I think what is happening is that because the Dialog box is a child of the SDI
Mar 11 '07 #1
Share this Question
Share on Google+
1 Reply


P: 2
I figured it out on my own.. works like a charm..

Bob
Mar 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.