Solved

Modeless Dialog

Posted on 1998-03-04
3
350 Views
Last Modified: 2013-11-20
I would like to ask how can I display a modeless dialog box.
Actually I created the modeless dialog using CDialog::Create.. After creating , the dialog box is not displayed.. Then I try to use ShowWindow() after the creation but the dialog box is still not displayed
0
Comment
Question by:Yinteo
3 Comments
 

Accepted Solution

by:
VexPI earned 50 total points
ID: 1316749
If you have Visual C++ 5.0 check on the CD in the /Samples/General/Modeless directory for a sample of a modeless dialog.

I believe you do a DialogName.DoModal();  even though the dialog should be modeless.

Check the samples!

Try DoModal(), too.
0
 
LVL 4

Expert Comment

by:jtwine100697
ID: 1316750
  Code like this has always worked for my non-modal dialog boxes:

/**/    CMyDialog::CMyDialog( CWnd *pParent ) :
            CDialog( IDD, pParent )
{
    Create( IDD, pParent );
    ShowWindow( SW_SHOW );

    return;
}

   If you have something like that, and it is not working, make sure that your dialog template (and all of its controls ) is/are loading correctly.

-=- James.
0
 

Expert Comment

by:vhegde
ID: 1316751
Here is what you need to do. Shown below is the code in the
dialog constructor

CModeLessDlg::CModeLessDlg(CWnd* pParent /*=NULL*/)
      : CDialog(CModeLessDlg::IDD, pParent)
{
      //{{AFX_DATA_INIT(CModeLessDlg)
            // NOTE: the ClassWizard will add member initialization here
      //}}AFX_DATA_INIT
      Create(CModeLessDlg::IDD,pParent);
}

Below is the code to create the dialog box (in view for example)

void CWebClientView::OnModelessDialog()
{
      // TODO: Add your command handler code here
      if(pDlg==NULL)   //pDlg is a Dialog pointer in view.h
      {
       pDlg=new CModeLessDlg(this);
       pDlg->ShowWindow(SW_SHOW);
      }

      
}

You can avoid calling ShowWindow if you set the the properties
of the dialog template properly. In particular, set the visible
property to true under "more styles"






0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Handling string inputs in C/Linux 23 168
Need Help INsttalling wget on Mavericks OS X 3 84
sum13 challenge 24 77
Making an alias 7 54
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now