如何将二进制数据嵌入/链接到Windows模块 [英] How to Embed/Link binary data into a Windows module

查看:100
本文介绍了如何将二进制数据嵌入/链接到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?

我已经查看了一些google链接,到目前为止,我还没有提出任何建议-我提出的唯一可能的解决方案是使用 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.

有什么建议吗?

推荐答案

  1. 右键单击资源脚本(.rc文件)
  2. 选择导入
  1. Right click the resource script (.rc file)
  2. 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...

如果没有资源脚本.

  1. 点击项目
  2. 添加新项目
  3. 资源脚本
  1. Click Project
  2. Add New Item
  3. Resource Script

http://msdn.microsoft.com /en-us/library/sxdy04be(v=VS.71).aspx

这篇关于如何将二进制数据嵌入/链接到Windows模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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