MFC - 资源 ID 唯一性 [英] MFC - Resource IDs uniqueness

查看:20
本文介绍了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 为 IDOKIDCANCEL 的按钮就是很好的例子.

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 唯一性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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