//如果这个对话框通过非模态的方式被创建,由于在PostNcDestroy(对话框销毁会被调用)中使用了delete this;不会发生内存泄漏 class CMessageDlg:public CDialog { public: void PostNcDestroy(); }; void CMessageDlg::PostNcDestroy() { CDialog::PostNcDestroy(); delete this; }
//如果这个对话框通过非模态的方式被创建,由于在PostNcDestroy(对话框销毁会被调用)中使用了delete this;不会发生内存泄漏 class CMessageDlg:public CDialog { public: void PostNcDestroy(); }; void CMessageDlg::PostNcDestroy() { CDialog::PostNcDestroy(); delete this; }