Loading Icons from an Icon library at runtime

  • Thread starter Thread starter xs
  • Start date Start date
X

xs

Does anybody know how to add Icons to a dll and then load the icons from the
dll at runtime? That means the ico files are stored inside the dll and not
outside of the library. Even better does anybody know how to load the icons
from Shell32 from Windows XP at runtime?

Thanks
 
Does anybody know how to add Icons to a dll and then load the icons from the
dll at runtime? That means the ico files are stored inside the dll and not
outside of the library. Even better does anybody know how to load the icons
from Shell32 from Windows XP at runtime?

Thanks

You can extract icons from a file with P/Invoke and ExtractIcon
or ExtractIconEx.

[DllImport("Shell32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr ExtractIcon(int hInst, string
lpszExeFileName, int nIconIndex);


// ExtractIconEx
[DllImport("Shell32.dll", CharSet=CharSet.Auto)]
public static extern int ExtractIconEx(string lpszFile, int
nIconIndex, out IntPtr phiconLarge, out IntPtr phiconSmall, int
nIcons);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top