Solved

MessageBox in Dialog based app

Posted on 1998-08-01
9
210 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 121
List out all word 7 291
sumNumber challenge 16 122
Detect file exist or not 3 156
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

770 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