从嵌入式资源流中读取
我一直在尝试访问名为“Images.resx”的嵌入式RESX 文件中名为“IndexPointer.jpg”的图像资源。 GetManifestResourceNames() 返回单个值 - SCtor.Images.resources"。Assembly
::GetExecutingAssembly()->GetManifestResourceStream("SCtor.Images.resources.IndexPointer.jpg")
仅返回 nullptr。显然,我得到了正确的名称是什么?
I've been trying to access an image resource named "IndexPointer.jpg" in an embedded RESX file called "Images.resx". GetManifestResourceNames() returns a single value - SCtor.Images.resources".
Assembly::GetExecutingAssembly()->GetManifestResourceStream("SCtor.Images.resources.IndexPointer.jpg")
only returns a nullptr. Obviously, I've got the manifest name wrong. What would be the correct one ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Reflector 打开程序集以找出正确的资源名称。
Open the assembly with Reflector to find out the correct resource name.
好吧,我终于想通了。奇怪的是,我记得遇到(并尝试)了可行的解决方案并忽略了它。无论如何,我使用程序集的资源实例化了一个 ResourceManager 对象,并使用其 GetObject 方法来提取嵌入的图像。
Well, I finally figured it out. Strangely, I recall coming across (and trying out) the working solution and disregarding it. In any case, I instantiated a ResourceManager object with my assembly's resource and used its GetObject method to extract the embedded image.