How to Embed/Link binary data into a Windows module(如何将二进制数据嵌入/链接到 Windows 模块中)
问题描述
所以我有一个 Visual Studio 2008 项目,其中包含大量当前引用的二进制数据.我想像使用 C# 一样打包二进制数据,将其添加为资源"并将其编译为 DLL.
So I have a Visual Studio 2008 project which has a large amount of binary data that it is currently referencing. I would like to package the binary data much like you can do with C# by adding it as a "resource" and compiling it as a DLL.
假设我的所有数据都具有.data"的扩展名,并且当前正在从 Visual Studio 项目中读取.
Lets say all my data has an extension of ".data" and is currently being read from the visual studio project.
有没有一种方法可以将数据编译或链接到它正在调用的 .dll 中?
Is there a way that you can compile or link the data into the .dll which it is calling?
我已经查看了一些谷歌链接,但到目前为止我还没有想出任何东西 - 我想出的唯一可能的解决方案是使用类似 ResGen 创建一个 .resources 文件,然后使用 AssemblyLinker 带有/Embed 或/Link 标志.我认为它不能正常工作,因为我没有文本文件来创建 .resources 文件,而是二进制文件本身.
I've looked at some of the google link for this and so far I haven't come up with anything - the only possible solution I've come up with is to use something like ResGen to create a .resources file and then link it using AssemblyLinker with /Embed or /Link flags. I dont think it'd work properly though because I dont have text files to create the .resources files, but rather binary files themselves.
有什么建议吗?
推荐答案
- 右键单击资源脚本(.rc 文件)
- 选择导入
- Right click the resource script (.rc file)
- Choose Import
http://msdn.microsoft.com/en-us/library/saced6x2.aspx
您可以嵌入任何您想要的自定义"文件,以及诸如 .bmps 之类的内容以及 VisualStudio知道"如何编辑的内容.然后,您可以使用框架的资源函数访问它们,例如 FindResource LoadResource 等...
You can embed any "custom" file you want, as well as things like .bmps and stuff VisualStudio "knows" how to edit. Then you can access them with your framework's resource functions like FindResource LoadResource etc...
如果您没有资源脚本.
- 点击项目
- 添加新项目
- 资源脚本
- Click Project
- Add New Item
- Resource Script
http://msdn.microsoft.com/en-us/library/sxdy04be(v=VS.71).aspx
这篇关于如何将二进制数据嵌入/链接到 Windows 模块中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将二进制数据嵌入/链接到 Windows 模块中


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