How do you make an icon that's compatible with Vista/7 and XP?

2.6k views Asked by At

Is there a way to make an icon file that includes a high-res .PNG copy of itself to be used with Windows 7 and Vista, but also includes the old-school .ico format so that it works with XP?

I recently had a problem with a program that I wrote crashing whenever it was run on an XP box that was caused by the app icon being a .PNG. Because Vista and 7 support higher resolution icons that can have transparencies and whatnot I'd like to use that, but I also need the program to run on XP so I need to have it include a .ico as well.

I can think of two solutions to this:

  1. Set the program so that it detects the operating system and it assigns the appropriate icon accordingly

  2. Perhaps there is a way to compile an icon file so that it includes both the .png format and Win7/Vista automatically uses that when it's available, and Windows XP just loads the .ico

Hopefully I've made that clear enough.. :)

  • Development Environment: Visual Studio 2010
  • Operating System: Windows 7 Ultimate
  • Language: C# .NET 4.0
1

There are 1 answers

2
Anders On BEST ANSWER

What exactly do you mean by png icon?

Icons on XP support alpha transparency, but they are not stored as png, but 32bit ARGB bitmap.

Vista added support for storing png images inside icons, but it is unclear to me if you are talking about this or just a .png renamed to .ico

There should be no problems with a proper .ico file that has embedded .png images on XP (XP will ignore those however, so you should only use the png format for the 256x256 image), maybe you should try a different icon editor: IcoFX and Greenfish Icon Editor are both free