获取MFC对话框ID的问题 [英] problem in getting ID of MFC DialogBox
问题描述
我在MFC中使用ID = IDD_DIALOG1创建了一个对话框
然后,我创建了一个名为myClassX的简单C ++类.
在构造函数myClassX()
中
当我尝试使用IDD_DIALOG1的名称时,它不会显示在intellisense中.
在构造函数中,我将代码用作:-
还有其他IDD _....名称.
可能是一个智能错误..
但是它甚至没有编译..
I created a dialog box in MFC using ID = IDD_DIALOG1
Then i created a simple C++ class named myClassX.
in the constructor myClassX()
when i am trying to use the name of IDD_DIALOG1, its not displaying in intellisense.
in constructor, i used the code as:-
Other IDD_.... names are there.
might be an intellisense error..
But its even not compiling..
myClassX::myClassX()
{
Create(IDD_DIALOG1, GetDesktopWindow());
}
其显示错误"Identifier ''IDD_DIALOG1'' is undefined.."
Its showing error "Identifier ''IDD_DIALOG1'' is undefined.."
Where''s could be the problem?
推荐答案
您必须包括头文件(可能在say``Dialog1.h''由 Chuck O''Toole 指出的"Resource.h"包含在myClassX
类实现源文件中的IDD_DIALOG1
定义(例如"myClassX.cpp") .
顺便说一句,为您的类型(和变量)赋予有意义的名称将有助于您的工作.
You must include the header file (say ''Dialog1.h''probably in ''Resource.h'', as pointed out by Chuck O''Toole) containing theIDD_DIALOG1
definition into themyClassX
class implementation source file (say ''myClassX.cpp'').
BTW Giving to your types (and variables) meaningful names would help your job.
这篇关于获取MFC对话框ID的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!