[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

OnInitDialog

Posted on 2001-06-07
6
Medium Priority
?
354 Views
Last Modified: 2006-11-17
I have a while statement that I run in OnInitDialog.  What happens now is when the program is executed, it runs the entire loop first, and then displayes the dialog.  
I would like it to display the diaplog first, then run the loop. How do I do this?
0
Comment
Question by:setfocus
[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
  • 3
  • 3
6 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 6164333
Is this an MFC application?
0
 

Author Comment

by:setfocus
ID: 6164334
Yes, it is.
0
 
LVL 30

Accepted Solution

by:
Axter earned 240 total points
ID: 6164386
When I need to do something like that, I add a bool member to the Dialog class.

Then in the constructor I set in false:
Example:
CTest1Dlg::CTest1Dlg(CWnd* pParent /*=NULL*/)
     : CDialog(CTest1Dlg::IDD, pParent)
{
     m_bMadeFirstPass=false;

Then I test this variable in the OnPaint function, and if it's false, I run the procedure.

Example:
void CTest1Dlg::OnPaint()
{
//..........do OnPaint suff first

     if (!m_bMadeFirstPass)
     {
          m_bMadeFirstPass=true;
          AfxMessageBox("Do your routine here");
     }
}
0
Industry Leaders: 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:setfocus
ID: 6164719
Would you add a BOOl member through class Wizard?  I am a new to C so any help would be appriciated.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6164770
Would you add a BOOl member through class Wizard?

You can add it directly to the class.
Example:

class CTest1Dlg : public CDialog
{
     bool m_bMadeFirstPass;
// Construction
public:
0
 

Author Comment

by:setfocus
ID: 6165357
It worked great, thanks.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

656 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