3

I need to know if a exe file contains at least one icon. A fast way, if that's possible. I tried with PrivateExtractIcons and it works, but only for 32 bit exe files.
It's not working for 64 bit exe files.
I need this to work with any exe file in any Windows >= XP (x86 and x64).

I'm using Delphi 2009.

Johan
  • 74,508
  • 24
  • 191
  • 319
DavidB
  • 177
  • 10

1 Answers1

6
  1. Call LoadLibraryEx passing LOAD_LIBRARY_AS_DATAFILE or LOAD_LIBRARY_AS_IMAGE_RESOURCE.
  2. Call EnumResourceTypes to check if the module has any icon resources.

Note that this is not exhaustive since some applications (e.g. modern Office) store their image assets in custom form and not icon resources.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490