Solved

Modeless Dialog

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

831 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