我在主对话框中的BOOL CCPJHDlg::PreTranslateMessage(MSG* pMsg) 中加入了:
if(pMsg->message == WM_KEYDOWN) {
if(pMsg->wParam == VK_F2)
{
OnButton2();
}
....
}void CCPJHDlg::OnButton2()
{
// TODO: Add your control notification handler code here CDlgCSMan dlg_csm;
int nResponse;
nResponse=dlg_csman.DoModal();
}
按F2后弹出dlg_csm对话框,再按确定,dlg_csm消失后系统就会提示出错。这是怎么回事?
错误信息内容是:
Debug Assertion Failed!
Program:.........\CPJH.exe
File:wincore.cpp
Line:875...
调试后,Wincore.cpp的部分内容是
// check for special wnd??? values
ASSERT(HWND_TOP == NULL); // same as desktop
if (m_hWnd == HWND_BOTTOM)
ASSERT(this == &CWnd::wndBottom);
else if (m_hWnd == HWND_TOPMOST)
ASSERT(this == &CWnd::wndTopMost);
else if (m_hWnd == HWND_NOTOPMOST)
ASSERT(this == &CWnd::wndNoTopMost);
else
{
// should be a normal window
第875行:-->> ASSERT(::IsWindow(m_hWnd)); // should also be in the permanent or temporary handle map
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL); CObject* p;
ASSERT((p = pMap->LookupPermanent(m_hWnd)) != NULL ||
(p = pMap->LookupTemporary(m_hWnd)) != NULL);
ASSERT((CWnd*)p == this); // must be us哪位高手可以指点一下,谢谢!!
if(pMsg->message == WM_KEYDOWN) {
if(pMsg->wParam == VK_F2)
{
OnButton2();
}
....
}void CCPJHDlg::OnButton2()
{
// TODO: Add your control notification handler code here CDlgCSMan dlg_csm;
int nResponse;
nResponse=dlg_csman.DoModal();
}
按F2后弹出dlg_csm对话框,再按确定,dlg_csm消失后系统就会提示出错。这是怎么回事?
错误信息内容是:
Debug Assertion Failed!
Program:.........\CPJH.exe
File:wincore.cpp
Line:875...
调试后,Wincore.cpp的部分内容是
// check for special wnd??? values
ASSERT(HWND_TOP == NULL); // same as desktop
if (m_hWnd == HWND_BOTTOM)
ASSERT(this == &CWnd::wndBottom);
else if (m_hWnd == HWND_TOPMOST)
ASSERT(this == &CWnd::wndTopMost);
else if (m_hWnd == HWND_NOTOPMOST)
ASSERT(this == &CWnd::wndNoTopMost);
else
{
// should be a normal window
第875行:-->> ASSERT(::IsWindow(m_hWnd)); // should also be in the permanent or temporary handle map
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL); CObject* p;
ASSERT((p = pMap->LookupPermanent(m_hWnd)) != NULL ||
(p = pMap->LookupTemporary(m_hWnd)) != NULL);
ASSERT((CWnd*)p == this); // must be us哪位高手可以指点一下,谢谢!!
call stack
出错的时候按retry
call stack
出错的时候按retry
//.h
class CDialog_1 : public CDialog
{
//
protected:
char m_Title[64]; const int m_CLASSSIZE;
char m_Class[8][64]; //对话框
CDialog_1_1 * m_pDialog_1_1;
};//.cpp
BOOL CDialog_1::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN)
{
switch(pMsg->wParam)
{
//
//Esc key(VK_ESCAPE) prssed
//
case VK_ESCAPE:
Handle_KeyEsc();
return true; //
//1 key(VK_1) prssed
//
case 0x31:
case 0x61:
Handle_Key1();
break ;
}
return CDialog::PreTranslateMessage(pMsg);
}void CDialog_1::Handle_Key1(void)
{
Language language;
language = Chinese;
PopDialog(language);
}void CDialog_1::PopDialog(Language & language)
{
if(m_pDialog_1_1->GetSafeHwnd() == 0)
{
m_pDialog_1_1->Create(IDD_DIALOG_1_1, this);
m_pDialog_1_1->SetLanguage(language);
m_pDialog_1_1->ShowWindow(SW_SHOW);
}
}BOOL CDialog_1::DestroyWindow()
{
DeleteResource();
return CDialog::DestroyWindow();
}void CDialog_1::NewResource(void)
{
m_pDialog_1_1 = new CDialog_1_1;
ASSERT(m_pDialog_1_1);
}
void CDialog_1::DeleteResource(void)
{
if(m_pDialog_1_1)
{
delete m_pDialog_1_1;
m_pDialog_1_1 = 0;
}
}
调试框内容为:
Context:CWnd::AssertValid()
m_hWnd 0x00040a48
this 0x00422aa0{CTempWnd hWnd=0x00040a48}
if(pMsg->wParam == VK_F2)
{
OnButton2();
return 1;
}
....
}不提示出错了,哪位高手分析一下,会不会还有什么可能存在的问题。