从内存中的可执行文件中提取图标
有谁知道一个 API 函数可以从 RAM 中的可执行文件中提取图标资源(例如,在 MemoryStream 中)?
到目前为止,我见过的所有图标提取功能都依赖于磁盘上存在的可执行文件。我想提取图标,而不必将 exe 写入临时文件,然后从中加载资源。
Does anyone know an API function to extract an icon resource from an executable file that's in RAM (inside, say, a MemoryStream)?
All of the icon-extracting functions I've seen so far depend on the executable file being present on disk. I'd like to extract the icon without having to write the exe to a temp file, and then loading the resources from it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这从来都不是一个真正的问题。 Windows 的硬性要求是可执行文件是磁盘上的文件。否则您无法启动进程。由于无论如何您都必须将文件写入磁盘,因此使用需要文件路径的 API 从文件中提取资源永远不会出现问题。
This is never a real problem. Windows has the hard requirement that an executable is a file on disk. You can't start a process otherwise. Since you have to write the file to disk anyway, you never have a problem extracting resources from it with an API that requires a path to a file.
如果我们正在讨论从已构建的 DLL 中获取图标,请使用 Reflector
打开 DLL,只需用鼠标右键单击图标,然后单击“另存为”
这也可以通过使用反射的代码来完成
最好的问候,
约丹
if we are talking about taking icon from already build DLL use Reflector
to open the DLL and the just click on the icon with the right mouse button and click Save As
also this can be done by code using reflection
Best Regards,
Iordan