Microsoft Visual C++ Debug Library
Debug Assertion Failed!
Program: …Files (x86)\BCGSoft\BCGControlBarPro\bin\MyDiagramEditorD.exe
File: f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp
Line: 942
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
中止(A) 重试® 忽略(I)
出错代码
函数执行完毕就崩溃:
BOOL CAmmeterPropertyShape::OnMouseDblClick(int nButton, const CBCGPPoint& pt)
{
CQueryDataPropertyParam param;
{
CDataPropertyConfigDlg dlg(&m_dataProperty,this->GetParentWnd());
if (dlg.DoModal() !=IDOK)
{
return FALSE;
}
param = dlg.GetDataPropertyParam();
}
SetDataProperty(param);
UpdateDataProperty();
//this->GetParentWnd()->GetParent()->PostMessage(WM_SET_DATA_PROPERTY,(WPARAM)this,0);
return TRUE;
}
解决办法:
this->GetParentWnd()->GetParent()->PostMessage(WM_SET_DATA_PROPERTY,(WPARAM)this,0);
自定义MFC消息,然后把处理函数放在主窗口中,
问题的原因:
可能是窗口不存在了,但是窗口消息还没有处理,主程序在处理消息时,发现窗口不存在了报错.