Click here to Skip to main content
Click here to Skip to main content

Windows Vista Icons

By , 4 May 2006
 

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

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)

About the Author

Vlasta_
Web Developer
Czech Republic Czech Republic
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberloulou_7501623 Mar '13 - 22:58 
Thank you for the tool!
GeneralNice tool.memberSimida19844 Nov '08 - 19:03 
Thanks.
GeneralResourceLib (C#)memberdB.28 Sep '08 - 9:08 
This article was helpful for writing icon support in http://www.codeproject.com/KB/library/ResourceLib.aspx (a generic resource reader/writer in .NET). Thx.   dB. - dblock.org
Generalno change on Vista (sp1)memberpeug27 May '08 - 21:26 
Hi,   I just try this and the command change the icon executable (VB6 exe) but when I place my EXE on Vista Computer I look the new icon only on detail and list mode. If I try the Very Big icons I show the older icon exe... ? thanks and good days...
GeneralRe: no change on Vista (sp1)memberVlasta_27 May '08 - 21:39 
Firts, make sure that the action was really successful. The UAC may ge in the way if you are changing icon of an installed app. Other than that, Vista may cache the old image, try creating a copy of the executable.
GeneralRe: no change on Vista (sp1)memberpeug27 May '08 - 21:45 
Yes you're right ! I create a copy of my executable and I look the good 256x256 icon ! magic   (ps : I developp still on XP and have 2 computers, So I use you command on XP)   THANKS !
GeneralRe: no change on Vista (sp1)memberpeug27 May '08 - 21:54 
"Vista may cache the old image"   Did you know how delete the cache ?
GeneralRe: no change on Vista (sp1)memberVlasta_27 May '08 - 22:06 
It is not as easy as it was in XP. The thumbnails are stores somewhere under your profile, you may delete all thumbnails from there. Also, it should be possible to remove them from that wizard for low disk space resolving.
GeneralNeeds a little UpdatememberKarstenK27 Mar '08 - 22:29 
Vista (and also a beta Version of the SP1) is out yet.   Greetings from Germany
GeneralRe: Needs a little UpdatememberVlasta_28 Mar '08 - 0:30 
As far as I know, the handling of icons is the same in beta, RTM and SP1.
GeneralThanksmemberAdresseBidon3125 Jun '07 - 22:13 
You help me a lot guy, thanks !!!
It works fine.
Smile | :)

Questionone function/variable can access globally?memberKhathar18 Apr '07 - 2:42 
hi friends!   i need to know if i create one global function in dialog based/SDI/MDI applicaion can access it all the sub dialogs?.. i tried lot but its showing either undeclared identifier.. or not member of speciedfied class..   for example if i declare any variable (like...
GeneralOddities with tool on released Vista32memberjohn723408320 Dec '06 - 5:11 
I tried this tool on XP and successfully was able to update the icon of my executable. I took the exe to a Vista machine and the icons showed up as expected (i.e. the 256x256 icon was visible). I did have behavior where a .tmp file was generated next to my exe sometimes. What is this behavior?...
NewsSetting Vista Icons in Visual Studios 6.0 under Windows 2000memberchris17520 Jul '06 - 5:12 
I really like what you did here. This was very useful for me.   I took your compiled executable and placed it in a static location that will be a standard for all projects. I then placed the vista icon file in my projects "res" folder.   Under "Projects->Settings->Post-Build Step...
GeneralStrong Named Assembliesmemberbobmwaldo9 May '06 - 4:15 
Have you tried this against Strong-Named assemblies? If I'm not mistaken, using the Win32API to modify resources after the assembly is built, will render the assembly useless.   Part of what strong naming does is performing a checksum to ensure that an assembly hasn't been tampered with...
GeneralRe: Strong Named AssembliesmemberVlasta_9 May '06 - 23:57 
No, I did not try it, but I think you are right. The assembly would need to be signed after the icon is replaced. I guess there are similar problems with localization.
GeneralOffice 2007 iconsmemberABuenger4 May '06 - 10:28 
I've tried BatchIconExtractor.exe to extract the icons from Office 2007, with no success. Any idea how I can extract them?   Thanks Andre
GeneralRe: Office 2007 iconsmemberVlasta_4 May '06 - 12:01 
Hard to guess what went wrong. If you would send me an example dll, that contains problematic icons to vlastimil.miler at gmail.com, I'd try to determine the cause.
AnswerRe: Office 2007 icons [modified]memberDarko Jovanovic16 Nov '06 - 5:12 
Office 2007 DLL is probably written in unmanaged code (non .NET) and it probably has the same Vista icon format. To extract these icons you will need eXeScope and ResourceHacker. Find those tools somewhere on the internet...   Use eXeScope to get to an icon that you want to extract. The...
GeneralUseful ArticlememberDarka4 May '06 - 7:27 
Some useful information, thanks.   regards,   [Xanya]

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 4 May 2006
Article Copyright 2006 by Vlasta_
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid