MFC - Resource IDs uniqueness(MFC - 资源 ID 唯一性)
问题描述
我正在使用外部资源开发 MFC 应用程序.
I'm working on an MFC application, using external resources.
resource.h 文件已由其他开发人员手动编辑,我发现存在冲突的 ID.
The resource.h file has been manually edited by other developers and I've seen that there are conflicting IDs.
我见过微软 TN020:ID 命名和编号约定.
我只是想知道控件和其他资源的 ID(不包括字符串)在整个应用程序中是否必须是唯一的,或者如果它们对于每个定义的对话框都是唯一的就足够了.
I was just wondering if the IDs for controls and other resources (strings excluded) must be unique in the whole application or it's just enough if they are unique for each defined dialog.
推荐答案
同一个对话框中的两个控件必须有不同的ID(使用IDC_STATIC时除外,即-1,在资源编辑器中).不同对话框中的两个控件可以具有相同的 ID,ID 为 IDOK 和 IDCANCEL 的按钮就是很好的例子.
Two controls in the same dialog must have different IDs (except when using IDC_STATIC, which is -1, in the resource editor). Two controls in different dialogs can have the same ID, good examples for that are buttons with the IDs IDOK and IDCANCEL.
这篇关于MFC - 资源 ID 唯一性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MFC - 资源 ID 唯一性
基础教程推荐
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- CString 到 char* 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
