自定义控件带来错误,例如“debug assertion failed!”。在afxwin2.inl第118行 [英] Custom control bring error like "debug assertion failed!" at afxwin2.inl line 118

查看:601
本文介绍了自定义控件带来错误,例如“debug assertion failed!”。在afxwin2.inl第118行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我使用的是Visual Studio 2008及其C ++(不支持clr)。我正在尝试使用自定义控件。我只是把它从
工具箱放到了Cdialog上。当我运行它时,我收到错误:


 


Debug Assertion failed!


程序:..... \ .... \ a.exe 


File:f:\dd\vctools\vc7libs\ship\ atlmfc\include\afxwin2.inl 


Line:118


 


顺便说一句,如果我从一开始就创建一个MFC应用程序,自定义控件就可以工作了。对于上面提到的Cdialog,它在大项目中用作子样式。 


有关如何解决它的任何想法?谢谢。

解决方案

嗯,afxwin2.inl中的第118行如下:_AFXWIN_INLINE void CWnd :: GetClientRect(LPRECT lpRect)const {ASSERT(:: IsWindow(m_hWnd)); :: GetClientRect(m_hWnd,lpRect); }< ---所以看起来像"m_hWnd"是无效的。我猜它是NULL。你能检查
你的自定义控件是否正确创建了吗? -Seetharam

Hi,

I am using Visual Studio 2008 and its C++ (without clr support). I am trying to use Custom Control. I just put it from toolbox onto a Cdialog. When I run it, I get the error:

 

Debug Assertion failed !

Program: .....\....\a.exe 

File : f:\dd\vctools\vc7libs\ship\atlmfc\include\afxwin2.inl 

Line:118

 

BTW, if I just create a MFC app from start, Custom control can work. For the Cdialog mentioned above, it is used as a child style in a big project. 

Any ideas for how to solve it? Thanks.

解决方案

Well, Line 118 in afxwin2.inl is the following: _AFXWIN_INLINE void CWnd::GetClientRect(LPRECT lpRect) const { ASSERT(::IsWindow(m_hWnd)); ::GetClientRect(m_hWnd, lpRect); } <--- So looks like the "m_hWnd" is invalid. I'm guessing its NULL. Can you check whether your custom control was created properly? -Seetharam


这篇关于自定义控件带来错误,例如“debug assertion failed!”。在afxwin2.inl第118行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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