Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display a non-modal CDialog?

Can someone tell me how I could create a Non Modal Dialog in MFC's Visual c++ 6.0 and show it? I wrote this code:

CDialog dialog;
if (dialog.init(initialization values...))
   dialog.DoModal();

But it blocks my application from showing the dialog. I dont know if there exists any method or other way to do it.

Thanks

like image 823
rufian de los 4 mares Avatar asked Feb 16 '10 09:02

rufian de los 4 mares


1 Answers

/* CChildDialog class is inherited from CDialog */
CChildDialog *m_pDialog = NULL;

// Invoking the Dialog
m_pDialog = new CChildDialog();

if (m_pDialog != NULL)
{
      BOOL ret = m_pDialog->Create(IDD_CHILDDIALOG, this);

      if (!ret)   //Create failed.
      {
         AfxMessageBox(_T("Error creating Dialog"));
      }    
      m_pDialog->ShowWindow(SW_SHOW);
}

// Delete the dialog once done
delete m_pDialog;
like image 116
Ramakrishna Avatar answered Sep 18 '22 13:09

Ramakrishna