1. Create such a dialog box
2. Right-click the current dialog box, and then find the add class, this drop-down menu option.
3. Add two lines of code in the MFC non-modal window Dlg.h:
#include “ImmodelDlg.h”
with
CImmodelDlg *m_pimmodelDlg;
4. Go to the structure and initialize it.
5. Create a non-modal dialog
m_pimmodelDlg = new CImmodelDlg();//指向一个非模对话框示例
m_pimmodelDlg->Create(IDD_DIALOG1, this);//创建
m_pimmodelDlg->ShowWindow(SW_SHOW);//显示
6, destruction
CMFC非模态窗口Dlg::~CMFC非模态窗口Dlg(){
if (m_pimmodelDlg != NULL){
delete m_pimmodelDlg;
m_pimmodelDlg = NULL;
}