父窗口下有一个TAB控件,TAB控件上方的CpropertyPage窗口,我想通过CpropertyPage的按钮关闭包含TAB控件的窗口
CpropertyPage代码如下:
void Cpage1::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData();
xa=m_X1;xb=m_X2;
ya=m_Y1;yb=m_Y2;
::SendMessage(GetParent()->GetParent()->m_hWnd,WM_CLOSE,0,0);
}
主窗口中的代码:
void FillDrawInfo::OnClose()
{
// TODO: Add your message handler code here and/or call default
delete this;
DestroyWindow();
CDialog::OnClose();
}
运行后弹出了一个错误对话框,显示:Debug Assertion Failed!
CpropertyPage代码如下:
void Cpage1::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData();
xa=m_X1;xb=m_X2;
ya=m_Y1;yb=m_Y2;
::SendMessage(GetParent()->GetParent()->m_hWnd,WM_CLOSE,0,0);
}
主窗口中的代码:
void FillDrawInfo::OnClose()
{
// TODO: Add your message handler code here and/or call default
delete this;
DestroyWindow();
CDialog::OnClose();
}
运行后弹出了一个错误对话框,显示:Debug Assertion Failed!
自己都析构了Ram里面的后续代码就被移除了
{
// TODO: Add your message handler code here and/or call default
DestroyWindow();
//delete this;
CDialog::OnClose();
}BOOL FillDrawInfo::DestroyWindow()
{
// TODO: Add your specialized code here and/or call the base class
delete this;
return CDialog::DestroyWindow();
}
这样还是不行啊!
void FillDrawInfo::OnClose()
{
// TODO: Add your message handler code here and/or call default
delete this;
DestroyWindow();
CDialog::OnClose();
}
把这个函数去了试试
{
// TODO: Add your specialized code here and/or call the base classBOOL ret = CDialog::DestroyWindow();
delete this;
return ret;
}