从PreTranslateMessage调用DoModal时给出错误 [英] giving an error while calling a DoModal from PreTranslateMessage

查看:166
本文介绍了从PreTranslateMessage调用DoModal时给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PreTranslateMessage中,我正在调用DoModal函数(以显示对话框),然后它显示对话框,并单击确定"按钮后,它给出了调试断言失败"错误.

错误如下:
调试断言失败!
程式:.. xxxx
文件:afxwin2.inl
线:265

此错误的原因是什么?

我们可以这样吗?

示例代码为:
BOOL CTry1 :: PreTranslateMessage(MSG * pMsg)
{
...
...
CMyDialog DlgObj;
DlgObj.DoModal();

返回CDialog :: PreTranslateMessage(pMsg);

}

执行最后一行返回CDialog :: PreTranslateMessage(pMsg);"时出现错误.

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);''.

推荐答案

调试器在哪一行停止?断言通常会告诉您有关其检查的无效内容.
What line is the debugger stopping on? The assert usually tells you something about what it checked that was invalid.


这篇关于从PreTranslateMessage调用DoModal时给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆