Solved

MessageBox in Dialog based app

Posted on 1998-08-01
9
219 Views
Last Modified: 2013-11-19
I'm trying to understand the following behavior.  In an App Wizard generated dialog based app, within the InitInstance() function, I can show a message box before dlg.DoModal() is called,  but after returning, it is not possible to show a message box.  Any call to a message box function after the dialog is dismissed simply does nothing. Could someone explain why.

Thank you,
Bruce O'Reilly
0
Comment
Question by:boreilly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
9 Comments
 
LVL 1

Accepted Solution

by:
chacko earned 100 total points
ID: 1320051
Message Box needs the parent window. In your case after the dialog is shown, there is no more parent available. But if you give the first parameter as NULL, there will be a messagebox created as orphan.
0
 
LVL 2

Expert Comment

by:duneram
ID: 1320052
In a dialog app, the dialog is the main window.  When you close the dialog, the EndDialog is called and in that process the message loop is terminated with a special WM_NULL sent as the last message.

I suspect because you message loop is dead, the dialog app won't let you display anything.  You should do your handling in the OK or Cancel of that dialog (or whatever response code is).

If you were writing a win32 console app, you could display message boxes wherever you want.  I supposed its because you are not using MFC to do the dirty work.  The fact that MFC has put in their window proc handler, but then told it to turn off (It only works if the dialog window handle is valid.  See Wincore.cpp 's
'int CWnd::RunModalLoop(DWORD dwFlags)'

would imply the system one may not be being called in this instance.
0
 
LVL 2

Expert Comment

by:duneram
ID: 1320053
that's a wrong answer.    Specifiying NULL is actually the desktop window so you are putting the desktop as the owner of the window.  
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:boreilly
ID: 1320054
Chacko's answer doesn't help.  It only tells me what I already suspected.  It's too general.  Making the parent window NULL also doesn't work.

Duneram's comment, although not a complete answer points me in a direction where I can do some further investingation.  It was quite helpful.

0
 
LVL 2

Expert Comment

by:duneram
ID: 1320055
true its not a complete answer, but you have already accepted the other.  Now the only people who can help you are the one's who have provided comments/answers to this thread.  You'll either have to get chacko or me to solve it or blow another 100 pts in a different question where everyone will be able to see it.  Or you could have ee admin reopen the question.

However it works out, good luck...
0
 

Author Comment

by:boreilly
ID: 1320056
How can I contact ee admin?
0
 
LVL 2

Expert Comment

by:duneram
ID: 1320057
true its not a complete answer, but you have already accepted the other.  Now the only people who can help you are the one's who have provided comments/answers to this thread.  You'll either have to get chacko or me to solve it or blow another 100 pts in a different question where everyone will be able to see it.  Or you could have ee admin reopen the question.

However it works out, good luck...
0
 
LVL 2

Expert Comment

by:duneram
ID: 1320058
0
 
LVL 2

Expert Comment

by:duneram
ID: 1320059
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

707 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