如何显示非模态CDialog? [英] How to display a non-modal CDialog?

查看:140
本文介绍了如何显示非模态CDialog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以说我怎么做一个没有模态对话框在MFC的Visual c + + 6.0中显示它?
我写了这个代码:

Can someone say me how I could do a No Modal Dialog in MFC's Visual c++ 6.0 for show it? I wrote this code:

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

但它阻止了我的应用程序显示对话框。我不知道是否存在任何方法或其他方法。

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

感谢

推荐答案

/* 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;

这篇关于如何显示非模态CDialog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆