从可执行文件中获取图标信息?

发布于 2024-10-01 16:05:42 字数 395 浏览 0 评论 0原文

我正在尝试使用以下 API 从 .exe 文件获取图标:
SHGetFileInfoW() SHGetImageList() 并从由此获得的 ImageList 中,我通过调用 GetIcon() 读取图标。

当机器的颜色深度设置为 32 位时,我得到 32 位颜色图标。问题是,当我将机器的颜色深度更改为 24 或 16 位时,我会得到一个 16 位颜色的图标,并且该图像似乎已损坏。

我还检查了一些常见 Windows 应用程序(记事本、画图等)和一些办公应用程序中的可用图标列表,没有一个有 16 位或 24 位颜色图标。

从可执行文件中获取正确图标的最佳方法是什么?

谢谢 !

I'm trying to get the icon from the .exe file using the following APIs:
SHGetFileInfoW() SHGetImageList() and from the ImageList thus obtained I read the icon by calling GetIcon().

When the color depth of the machine is set to 32bit I get the 32bit color icon. The issue is when I change the machine's color depth to 24 or 16 bit then I get a 16bit color icon and this image seems to be corrupted.

I also checked for the list of available icons in some of the common windows applications (notepad, paint etc) and some of the office applications, none of had 16bit or 24 bit color icons.

What would be the best way to get the proper icons from the executable file ?

Thanks !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

内心旳酸楚 2024-10-08 16:05:42

您可以使用 LoadLibraryEx 加载 exe,然后使用 LoadImage 提取图标 - 或者 - 如果您想直接访问图标数据:FindResource、LoadResource、LockResource 将为您提供指向图标资源位的指针。

You can load exe's using LoadLibraryEx, and then extract the icons using LoadImage - or - if you want direct access to the icons data: FindResource, LoadResource, LockResource will give you a pointer to the icon's resources bits.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文