Question

I am extracting the icon from .exes, but want to have a fallback generic icon if for some reason Icon.ExtractAssociatedIcon(sPathOfExe) fails.

Is there one I can resort to like so that would be safer than what I'm currently using:

private const string defaultIcon = @"C:\WINDOWS\ServicePackFiles\i386\msnms.ico";
Was it helpful?

Solution

You can always fall back to one of the SystemIcons located in the System.Drawings class:

An example:

Icon appIcon = System.Drawing.SystemIcons.Application;

OTHER TIPS

I think you can not get an ico file that will always be available. Probably you can find one that exists nowadays, on most versions, but you have no guarantee it will still be available in future versions.

Why not:

  1. ship a ico file with your software
  2. do a recursive serach for ico files inside the Windows folder?

HTH

If you can create and distribute your own application then what is stopping you to add your own icon to the application as a default icon ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top