我建立了一个非模式对话框,但最后关闭的时候,如果关闭窗口的时候,它会调用OnClose().而不会调用OnDestroy(),最后在关闭程序的时候,调试信息会有这么一句:
Warning: calling DestroyWindow in CDialog::~CDialog --
OnDestroy or PostNcDestroy in derived class will not be called.
程序如下:
我在Device类中,定义了一个成员变量CDlgInfo dlgInfo;
然后在Device的构造函数里执行了一下语句:
dlgInfo.Create(IDD_INFO,(CMainFrame*)pParent);
dlgInfo.ShowWindow(SW_SHOW);
Warning: calling DestroyWindow in CDialog::~CDialog --
OnDestroy or PostNcDestroy in derived class will not be called.
程序如下:
我在Device类中,定义了一个成员变量CDlgInfo dlgInfo;
然后在Device的构造函数里执行了一下语句:
dlgInfo.Create(IDD_INFO,(CMainFrame*)pParent);
dlgInfo.ShowWindow(SW_SHOW);
什么意思啊,可否说得详细点
void CSampleDialog::PostNcDestory()
{
delete this;
}
xxx.h
...
virtual afx_msg void OnCancel();
...xxx.cpp
void CXXXDlg::OnCancel()
{
DestroyWindow();
}
万一失败,很麻烦的!
dlg->Create(ID);
dlg->ShowWindow (SW_SHOW);
{
// TODO: Add your specialized code here and/or call the base class
m_pParent->SendMessage(WM_SETUP_DELETE);
delete this;
CDialog::PostNcDestroy();
}