1

I'm trying to get many large (48x48, 256x256, etc.) icons from an exe file and place them in a ListView control. Icon.ExtractAssociatedIcon() only gets a 32x32 image which is too small, are there any alternative methods I could use? I've looked at solutions like this but they don't work.

Widdiful
  • 21
  • 4
  • This link looks like it will do what you want but it is not managed code: http://www.brad-smith.info/blog/archives/164 – Matt Wilko Nov 06 '14 at 12:06
  • Thanks for the reply but this isn't quite what I was looking for. The program I'm working on has a built-in file browser that loads shortcut files in a folder and runs the shortcut when clicked. The icons are those of the shortcut's target file. Also, when using the part of the code that begins [DLLImport], I get a lot of 'declaration expected' errors. How can I get around this? – Widdiful Nov 06 '14 at 12:22
  • @Widdiful : To obtain an Icon object which size is NOT 16x16 or 32x32, you must go the hard way and get rid of ExtractAssociatedIcon() : Locate the exe/dll, use your own Ressources extractor from exe or dll, extract the indexed icon chunck, read the formats contained in the icon and locate the one you're looking for (write it to a stream A), create a new binary icon stream B with DIB header-chuncks-etc the size of your target icon, write the stream A to B, then create a new Icon object using stream B. – Karl Stephen Nov 06 '14 at 13:42
  • 1
    @Widdiful : That means what you want is a code project, _which you won't get here at SO I'm afraid_. Google "extract icon ressource from exe" to start with. DLLImport... read the documentation ! `Imports System.Runtime.InteropServices`. You could have searched [here](http://stackoverflow.com/questions/2229793/how-to-use-dllimport-in-vb-net) or on [google](https://www.google.mg/?gws_rd=ssl#q=dllimport+vb+net) aswell – Karl Stephen Nov 06 '14 at 13:46
  • @fsintegral: Thank you! I'll give that a go and see how I get on. – Widdiful Nov 06 '14 at 15:13
  • @Widdiful: Did you finally find anything my friend? – Simos Sigma Jan 28 '18 at 09:49

0 Answers0