Click here to Skip to main content
15,881,172 members
Articles / Multimedia / GDI
Article

Windows Vista Icons

Rate me:
Please Sign up or sign in to vote.
4.78/5 (32 votes)
4 May 2006CPOL3 min read 159.6K   2.6K   59   22
Describes changes in .ico format in Windows Vista and explains how to compile Vista icons into your applications.

Images in Vista icon

Windows Vista icons contain hi-res 256x256 pixels images.

Introduction

This article describes the basic differences between Windows XP and Windows Vista icons and explains how to use Vista icons in your applications.

Vista icons

Four years ago, Microsoft extended the .ico format and allowed 32bit RGBA images (with 8bit alpha channel) inside .ico files. These icons are known as Windows XP icons and are easily recognized by their smooth antialiased edges.

Beta 1 and Beta 2 of Windows Vista indicate that Microsoft is going to make another change to the .ico format. Icons in current Vista builds differ in two aspects from Windows XP icons:

  • Vista icons contain large high-resolution 256x256 images
  • The large images are stored using PNG compression

The use of PNG compression is a breaking change. Windows XP and previous are only able to use those images from an icon that are not compressed.

The icon format allowed to use 256x256 images before, so why did Microsoft introduce the PNG compression? We can only guess, but since the uncompressed icon with all Vista formats occupies more then 400kB, the answer is obvious.

Windows Vista Explorer uses the hi-res image and dynamically resamples them to required resolution.

Problems compiling Vista icons

If you try to compile a Vista icon into application resources using Visual Studio resource compiler, the tool aborts with error and refuses to accept the icon in Vista format. This error is reported from all versions of Visual Studio including VS 2005.

How to use the tool

The tool accompanying this article is able to replace or add an icon to an already compiled executable. It has an easy command line interface and can be configured to run as a post-build step in Microsoft Visual Studio.

Parameters

plain
ReplaceVistaIcon.exe executable.dll icon.ico [icon_ID [language_code]]

The command will replace or add icon.ico to executable.dll. The icon will be replaced if you specify icon_ID, otherwise it will be added to the list of icons.

Implementation

The tool does not modify the executable directly. Instead it uses Win32 API for resource manipulation and works under all NT-based systems. There should be no compatibility problems, because it links the static version of C runtime.

The implementation is pretty straightforward, the tool:

  • Reads and analyzes the icon
  • Enumerates icon resources in the executable (icon resource is actually a bit more complicated than other kinds of resources, because it consists of an icon directory, that holds the references to images, and the actual images)
  • Optionally removes the icon that is being replaced
  • Adds the new icon into the executable

Points of Interest

I used the tool on itself and the compiled executable already contains a Vista-compatible icon (the one on the picture).

History

  • 1.0 - posted on May 4th, 2006

Conclusion

Vista is still in beta phase and Microsoft will likely resolve the problems with resource compiler by the time Vista is released making this tool obsolete. (What compiler is Microsoft using to compile Windows Vista anyway?)

Still, Microsoft may not issue a patch for all versions of their development environments and there are plenty of third party Windows compilers, so the tool may find its place even after Microsoft addresses the issue.

Windows Vista delivers stunning visual capabilities and the new, hi-res icons are an inseparable part of it. Exploring and exploiting new concepts of Vista is an exciting experience, especially for someone like me, who is involved in development of icon authoring software.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Czech Republic Czech Republic
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Bugcount off Pin
pggcoding7-May-18 0:45
pggcoding7-May-18 0:45 
QuestionAny interest in a linux version? Pin
Member 102285674-Nov-14 5:02
professionalMember 102285674-Nov-14 5:02 
GeneralMy vote of 5 Pin
loulou_7501623-Mar-13 22:58
loulou_7501623-Mar-13 22:58 
GeneralNice tool. Pin
Simida19844-Nov-08 19:03
Simida19844-Nov-08 19:03 
Thanks.
GeneralResourceLib (C#) Pin
dB.28-Sep-08 9:08
dB.28-Sep-08 9:08 
Generalno change on Vista (sp1) Pin
peug27-May-08 21:26
peug27-May-08 21:26 
GeneralRe: no change on Vista (sp1) Pin
Vlasta_27-May-08 21:39
Vlasta_27-May-08 21:39 
GeneralRe: no change on Vista (sp1) Pin
peug27-May-08 21:45
peug27-May-08 21:45 
GeneralRe: no change on Vista (sp1) Pin
peug27-May-08 21:54
peug27-May-08 21:54 
GeneralRe: no change on Vista (sp1) Pin
Vlasta_27-May-08 22:06
Vlasta_27-May-08 22:06 
GeneralNeeds a little Update Pin
KarstenK27-Mar-08 22:29
mveKarstenK27-Mar-08 22:29 
GeneralRe: Needs a little Update Pin
Vlasta_28-Mar-08 0:30
Vlasta_28-Mar-08 0:30 
GeneralThanks Pin
p.bonnetaud25-Jun-07 22:13
p.bonnetaud25-Jun-07 22:13 
Questionone function/variable can access globally? Pin
Khathar18-Apr-07 2:42
Khathar18-Apr-07 2:42 
GeneralOddities with tool on released Vista32 Pin
john723408320-Dec-06 5:11
john723408320-Dec-06 5:11 
NewsSetting Vista Icons in Visual Studios 6.0 under Windows 2000 Pin
Christopher Stratmann20-Jul-06 5:12
Christopher Stratmann20-Jul-06 5:12 
GeneralStrong Named Assemblies Pin
waldosax9-May-06 4:15
waldosax9-May-06 4:15 
GeneralRe: Strong Named Assemblies Pin
Vlasta_9-May-06 23:57
Vlasta_9-May-06 23:57 
GeneralOffice 2007 icons Pin
Andre xxxxxxx4-May-06 10:28
Andre xxxxxxx4-May-06 10:28 
GeneralRe: Office 2007 icons Pin
Vlasta_4-May-06 12:01
Vlasta_4-May-06 12:01 
AnswerRe: Office 2007 icons [modified] Pin
Darko Jovanovic16-Nov-06 5:12
Darko Jovanovic16-Nov-06 5:12 
GeneralUseful Article Pin
Jonathan [Darka]4-May-06 7:27
professionalJonathan [Darka]4-May-06 7:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.