Solved

Modeless Dialog

Posted on 1998-03-04
3
360 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 37
Best tools for Backup and restore of Wordpress site 6 55
sum67 challenge 35 93
has77  challenge 9 72
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 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

17 Experts available now in Live!

Get 1:1 Help Now