Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MessageBox in Dialog based app

Posted on 1998-08-01
9
Medium Priority
?
229 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…
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.
Loops Section Overview

597 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