初始化弹出对话框出现诊断性异常
初始化弹出对话框出现诊断性错误
我建了一个SDI,在菜单里设置了个菜单项弹出个对话框,当程序运行到
对话框的CDialog::OnInitDialog();程序进入dlgdata.cpp的PrepareCtrl函数
(附录如下),在ASSERT(FALSE);这里退出了程序
这是怎么回事,怎样解决?
HWND CDataExchange::PrepareCtrl(int nIDC)
{
ASSERT(nIDC != 0);
ASSERT(nIDC != -1); // not allowed
HWND hWndCtrl;
m_pDlgWnd-> GetDlgItem(nIDC, &hWndCtrl);
if (hWndCtrl == NULL)
{
TRACE1( "Error: no data exchange control with ID 0x%04X.\n ", nIDC);
ASSERT(FALSE); ///////这里出现错误,退出程序了
AfxThrowNotSupportedException();
}
m_hWndLastControl = hWndCtrl;
m_bEditLastControl = FALSE; // not an edit item by default
ASSERT(hWndCtrl != NULL); // never return NULL handle
return hWndCtrl;
}
------解决方案--------------------
nIDC是不是对话框上不存在的控件?
------解决方案--------------------
ASSERT(FALSE);?不应该出错啊?
------解决方案--------------------
nIDC没定义吧? 定义一个控件试试
------解决方案--------------------
nIDC不是正确,就这样!
我建了一个SDI,在菜单里设置了个菜单项弹出个对话框,当程序运行到
对话框的CDialog::OnInitDialog();程序进入dlgdata.cpp的PrepareCtrl函数
(附录如下),在ASSERT(FALSE);这里退出了程序
这是怎么回事,怎样解决?
HWND CDataExchange::PrepareCtrl(int nIDC)
{
ASSERT(nIDC != 0);
ASSERT(nIDC != -1); // not allowed
HWND hWndCtrl;
m_pDlgWnd-> GetDlgItem(nIDC, &hWndCtrl);
if (hWndCtrl == NULL)
{
TRACE1( "Error: no data exchange control with ID 0x%04X.\n ", nIDC);
ASSERT(FALSE); ///////这里出现错误,退出程序了
AfxThrowNotSupportedException();
}
m_hWndLastControl = hWndCtrl;
m_bEditLastControl = FALSE; // not an edit item by default
ASSERT(hWndCtrl != NULL); // never return NULL handle
return hWndCtrl;
}
------解决方案--------------------
nIDC是不是对话框上不存在的控件?
------解决方案--------------------
ASSERT(FALSE);?不应该出错啊?
------解决方案--------------------
nIDC没定义吧? 定义一个控件试试
------解决方案--------------------
nIDC不是正确,就这样!