应用程序中使用指针创建了对话框,在析构函数中使用delete时,会出现以下警告:
AppMsg - Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called.
AppMsg - Warning: calling DestroyWindow in CDialog::~CDialog --
AppMsg - OnDestroy or PostNcDestroy in derived class will not be called.
我们在释放对话框指针的时候应该先通过对话框指针调用DestroyWindow()方法,然后再用delete删除。
C**Dlg::~C**Dlg()
{
if(m_pWebDlg != NULL)
{
m_pWebDlg->DestroyWindow();
delete m_pWebDlg;
}
}
只有这样才可以把这个警告给去掉