如何在.exe文件中提取图标? [英] How to extract icon in a .exe file?

查看:94
本文介绍了如何在.exe文件中提取图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一些图标(代表该文件)的.exe文件.您能告诉我如何提取该图标并显示在图片框中吗?

您的帮助将不胜感激!

I have a .exe file with some icon (which represents the file). Could you please tell me how to extract that icon and display in a picturebox?

Your help would be highly appreciated! Thanks!

推荐答案

该图标就在其中,如果您使用的是Visual Studio,则可以使用[主菜单] =>加载.exe.文件=>打开…=>文件.如果将打开一种资源查看器以显示嵌入在可执行模块中的资源.

但是,您要执行的操作有些可疑.为什么?只是想提醒您,资源可能是作者受法律保护的知识产权的主题.同样,即使图标可以显示在PictureBox中,也通常没有任何意义,因为这些图标是为不同目的而设计的.一个图标在一个文件中包含几张标准尺寸的图像,因此操作系统在不同情况下使用不同的图像.使用图片框时,您不会使用它.图标仅用作应用程序图标和系统窗口图标.对于图片框,您可能需要将图标转换为位图.此外,在很多情况下使用图片框但实际上是无用的-您不需要此控件即可在任何控件中显示图像.



我很抱歉,如果不很清楚如何检索资源.这只是示例.

我找到了文件"c:\ Program Files \ Common Files \ Microsoft Shared \ OFFICE12 \ MSOXMLED.EXE",并使用主菜单将其加载到Visual Studio中,如上所示.在由此创建的窗口中,我可以看到带有第一个节点"Icon"及其子节点"IDI_APP_ICON"的树形视图.选择此图标后,我激活上下文菜单并选择"E x 端口".就这样.

-SA
It the icon is there, and if you have Visual Studio, you can load .exe using [Main menu] => Files => Open… => File. If will open a kind of resource viewer to show the resources embedded in the executable module.

However, what you want to do is somewhat suspicious. Why? Just want to remind you that a resource could be a subject of the author''s intellectual property protected by the law. Also, even though an icon can be shown in a PictureBox, it usually makes no sense, as the icons are designed for different purposes; an icon contains several images of standard sizes in one file, so the OS uses different images in different situations. With picture boxes, you don''t use it. Icons are only uses as application icon and system window icons. For picture boxes, you might need to convert an icon into a bitmap. Besides, there are many situations where a picture box is used but actually useless — you don''t need this control to show an image in any control.



I''m sorry if it was not obvious how to retrieve the resource. Here is just the example.

I located the file "c:\Program Files\Common Files\Microsoft Shared\OFFICE12\MSOXMLED.EXE" and loaded it in Visual Studio using main menu as shown above. In the window created as a result, I can see a tree view with the first node "Icon" and its child node "IDI_APP_ICON". Having this icon selected, I activate a context menu and choose "Export". That''s it.

—SA


只需使用 P/调用 [ ^ ]来获取它.其他一些建议
Just use the LoadIcon()[^] function; although as this is C# you may need to use P/Invoke[^] to get it. Some other suggestions here[^].


这篇关于如何在.exe文件中提取图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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