Solved

Modeless Dialog

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

Technology Partners: 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!

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

726 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