GetDlgItem返回NULL,并且显示窗口在调试模式下引发异常 [英] GetDlgItem returns NULL and Show window throws exception in debug mode

查看:284
本文介绍了GetDlgItem返回NULL,并且显示窗口在调试模式下引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个对话框,其中以编程方式创建了2个控件.

对话框或控件的GetDlgItem返回NULL,因此返回异常.

请指导如何更正此问题.

代码:

Hi,

I have a dialog in which i have created 2 controls programatically.

GetDlgItem either for the dialog or for the controls returns NULL and hence the exception.

Please guide how to correct this.

code:

GetDlgItem(ID_STATIC_MULTI)-> MoveWindow(5,5,width,length);


在以下地点发现了ID_STATIC_MULTI :
1).rc
2).h
3).cpp


ID_STATIC_MULTI is found in foll places:
1) .rc
2) .h
3) .cpp

推荐答案

您可能使用错误的控件标识符调用GetDlgItem .发布一些代码以便可以验证.

好的,根据您的代码,似乎您确实定义了该标识符,但这并不意味着您使用该ID创建控件.在创建子控件的地方显示代码.
You are probably call GetDlgItem with the wrong control identifiers. Post some code so that can be verified.

Okay, based on your code, it seems you do have that identifier defined, but that does not mean you create your controls using that id. Show the code where you create the child controls.


这篇关于GetDlgItem返回NULL,并且显示窗口在调试模式下引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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