本文介绍了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.

我看过Microsoft TN020:ID命名和编号约定.

I've seen the Microsoft TN020: ID Naming and Numbering Conventions.

我只是想知道控件和其他资源的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的唯一性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 21:05