Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In PreTranslateMessage, i am calling DoModal function (to show the dialog box) and then it is showing the dialog box and after clicking on the OK button it is giving the Debug Assertion Failed error.

error is as follows:
Debug Assertion Failed!
Program:..xxxx
File:afxwin2.inl
Line:265

what is the cause of this error?

can we do like this?

Sample Code is :
BOOL CTry1::PreTranslateMessage(MSG* pMsg)
{
...
...
CMyDialog DlgObj;
DlgObj.DoModal();

return CDialog::PreTranslateMessage(pMsg);

}

it is giving error while executing the last line 'return CDialog::PreTranslateMessage(pMsg);'.
Posted
Updated 15-Jun-11 23:40pm
v2
Comments
Sergey Alexandrovich Kryukov 14-Jun-11 13:04pm    
Needs your code to answer. Better yes, look by yourself under debugger.
--SA

1 solution

What line is the debugger stopping on? The assert usually tells you something about what it checked that was invalid.
 
Share this answer
 
Comments
sunnyram 16-Jun-11 2:46am    
it is giving debug assertion error while executing the following line
"return CDialog::PreTranslateMessage(pMsg);"

before this line i am calling DoModal function of the CMyDialog class.
Albert Holguin 16-Jun-11 11:40am    
What does the assert line assert though?
sunnyram 17-Jun-11 2:26am    
BOOL CWnd::PreTranslateMessage(MSG* pMsg)
{
// handle tooltip messages (some messages cancel, some may cause it to popup)
AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
if (pModuleState->m_pfnFilterToolTipMessage != NULL)
(*pModuleState->m_pfnFilterToolTipMessage)(pMsg, this);

// no default processing
return FALSE;
}


it is giving error for the following line in above code
(*pModuleState->m_pfnFilterToolTipMessage)(pMsg, this);
Albert Holguin 17-Jun-11 9:19am    
you're still not answering my question... what does the assert say? ... should say something like ASSERT(hWnd!=NULL); or something like that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900