Display Icon of an Executable or Dll lazarus / 34-Windows ---------------------------------------------------------------------- khoward · 2014-09-03 13:58 Hello everyone! I am a novice to Free Pascal/Lazarus and am trying to make a toolbar for Windows that you can drag and drop an item onto it, which creates a button (of type Tbitbtn) at runtime and displays it's corresponding application icon. I do not know how to 'extract' the icon from an executable, dll, or folder and display it in the Tbitbtn. Does someone have a link that they could share or provide a code example as to how this is done? Thanks in advance! Keith ---------------------------------------------------------------------- Never · 2014-09-03 16:48 here is a delphi example to extract icon from exe [ http://www.swissdelphicenter.ch/torry/showcode.php?id=720 ] i belive will do dlls too After you save the file you can loaded using  BitBtn1.Glyph.LoadFromFile();  or read this [ http://forum.lazarus.freepascal.org/index.php?topic=18588.0 ] ---------------------------------------------------------------------- khoward · 2014-09-03 17:33 Thanks, Never! I'll give that a try....is it possible to load from a stream?  I mean, to NOT load from a file? Thanks again! Keith ---------------------------------------------------------------------- khoward · 2014-09-03 17:51 I asked that last question prematurely....looks like Icon.SaveToStream and then TbitBtn.Glyph.LoadFromStream would have made sense! Thanks again! ---------------------------------------------------------------------- khoward · 2014-09-03 18:06 OK, I tried that sample and I get: Code: [Select]Error:Identifier not found "SHGFI_ICON"   Hints? Thanks! Keith ---------------------------------------------------------------------- khoward · 2014-09-03 18:13 Found it!  I needed: Uses shellAPI; Thanks! ---------------------------------------------------------------------- khoward · 2014-09-03 18:30 Hmmm.....now I get a run-time error: Wrong Image Format.  Hints? Keith ---------------------------------------------------------------------- khoward · 2014-09-03 18:44 Got it! Thanks to this, from Blaazen: http://forum.lazarus.freepascal.org/index.php?topic=18588.0 Keith