出现“OnDestroy or PostNcDestroy in derived class will not be called.”问题

在DLL中创建对话框时,会在输出里出现这个问题

“Warning: calling DestroyWindow in CDialog::~CDialog --
OnDestroy or PostNcDestroy in derived class will not be called.”

说明在销毁的时候应该先DestroyWindow,再进行delete。如果只是delete,不会调用子类的OnDestroy 和PostNcDestroy这两个消息

销毁时应该:

if(m_dlg)

{

m_dlg->DestroyWindow();

delete m_dlg;

m_dlg = NULL;

}

你可能感兴趣的:(错误解析)