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

查看:24
本文介绍了在 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 设置为 YES.

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天全站免登陆