mfc non-modal dialog

1. Create such a dialog box
Insert picture description here
2. Right-click the current dialog box, and then find the add class, this drop-down menu option.
Insert picture description here

3. Add two lines of code in the MFC non-modal window Dlg.h:

#include “ImmodelDlg.h”

with

CImmodelDlg *m_pimmodelDlg;
Insert picture description here
4. Go to the structure and initialize it.
Insert picture description here
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;

}

Guess you like

Origin blog.csdn.net/qq_23350817/article/details/112278577