mfc140ud.dll中的调试断言失败

时间:2016-05-02 15:52:37

标签: c++ mfc dialog

当我创建一个新对话并在其上调用DoModel时。我得到以下调试断言。

代码是

if (m_pWatchDogDialog->WatchDogServer().CurrentUserStatus() == CServerLink::AWAY)
                {
                    CString msg("Requested user is away");
                    m_pWatchDogDialog->WatchDogServer().SendUserMessage(m_UserKey, msg);
                }
            else
            {
                AcceptFile *dlg = new AcceptFile();
                dlg->DoModal(); // error is throwing up here
            }

错误如下所示

enter image description here

The Assertion is at the debug point as shown in image in dlgcore.cpp file

1 个答案:

答案 0 :(得分:0)

假设AcceptFile继承自CDialog,可能可以通过使用lpszTemplateName参数调用CDialog构造函数来扩展AcceptFile构造函数来阻止调试断言。例如:

class AcceptFile : public CDialog
{
public:
    AcceptFile(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL)
        : CDialog(lpszTemplateName, pParentWnd)
    {
        // your code here
    }

// other stuff
};