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 唯一性


基础教程推荐
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 常量变量在标题中不起作用 2021-01-01