在MFC项目中使用多个资源文件 [英] Using multiple resource files in MFC project

查看:267
本文介绍了在MFC项目中使用多个资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在VS2015的MFC(C ++ 11)中工作,我有一组独立的GUI,我想在多个项目中使用.我知道通过创建一个.rc文件是可能的,该文件可以基于以下内容包含在每个项目的主.rc文件中: 使用多个资源文件

I'm working in MFC (C++11)in VS2015 and I have a set of standalone GUIs that i'd like to use across multiple projects. I know this is possible by creating a .rc file that can be included in the main .rc file of each project based on this: Using Multiple Resource Files

虽然从概念上我理解了它的描述,但是找不到创建独立的.rc文件和第二个资源文件的任何示例.我创建了一个测试资源头文件,该文件全局存在于我的解决方案中,并尝试使用Resource Includes将其包括在内,但是即使使用路径也无法找到它.谁能指出我有关如何进行设置的链接或示例?

While conceptually I understand what it is describing, i can't find any example of creating the standalone .rc file and second resource file. I created a test resource header file that lives globally in my solution and tried to include it using Resource Includes, but it can't find it, even with the path. Can anyone point me to links or examples on how to set this up?

推荐答案

我有两个.rci文件,它们从未与资源编辑器一起使用.它们可以自由地与#include一起使用.

I have either .rci files, that are never used with the resource editor. They are used with #include freely.

或者我有特殊的.rc文件,其中包含标准符号和消息,这些文件和符号在大量项目中使用.

Or I have special .rc files that contain standard symbols and messages, that are used over a larger set of projects.

我只是简单地将第二个rc文件添加到项目中.该资源文件只是被#include'包含在项目的主.rc文件中.

I just simply add the second rc file to the project. This resource file is simply #include'ed into the main .rc file of the project.

为防止项目中的错误.第二个.rc文件从构建中排除.在解决方案资源管理器中,右键单击该项目.并将Exclude from Build设置为是".

To prevent errors in the project. This second .rc file is excluded from the build. In the solution explorer right click on the item. And set Exclude from Build to YES.

请注意ID的冲突.

这篇关于在MFC项目中使用多个资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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