Compiling compressed Windows Vista icons
Compiling compressed Windows Vista icons
RealWorld Graphics logo    
Log-in or register.   
IndexSoftwareGalleryTutorialsForumsUsers

What is a ...
How to make a ...
More about ...
compiling Vista icon
editing images
shadow in icons
high DPI in Vista
Video guide on...
Free Online Icon Maker
Icon Shortcut Maker
Links
Search this site using Google

Bookmark this page

del.icio.us iconDel.icio.us
Digg iconDigg it
StumbleUpon iconStumbleUpon
Yahoo MyWeb iconYahoo MyWeb
Furl iconFurl it


What about ICL files?

Select background

Windows Vista icons

Find out how Vista icons differ from XP icons.

See how RealWorld Icon Editor handles Vista icons.

   

How to compile Windows Vista icons?

January 28th 2006

This article explains basic properties of Windows Vista icons and describes how to use Vista icons in your applications.

Find more information about Vista icons in an article explaining differences between XP and Vista icons.

Vista icons

Windows Vista icons contain a high resolution 256x256 pixels images. These images are used exclusively by Vista and they are stored using PNG-based compression. Explorer dynamically resamples them to required resolution.

An example vista icon with projected shadow
An icon with Vista image format. Large resolution makes it possible to add an additional effect - a projected shadow.
You may download this icon here.

Compiling Vista icons

Although numerous dynamic libraries and executables in the current Vista build contain compressed icons, Visual Studio (including VS2005) resource compiler refuses to accept them and aborts with:
"error RC2176 : old DIB in VistaIcon.ico; pass it through SDKPAINT".

Solution

It is hard to guess when or how is Microsoft going to address this issue. Right now, it is necessary to use alternate resource compiler, manager, or tool.

The following tool was prepared to deal with the problem. It has a very simple command-line interface and you can integrate it into your build process as a post-build step. The tool can replace or add an icon into an executable file using the Windows resource API.

Download the tool from here: ReplaceVistaIcon.exe

The tool accepts two to four arguments:
ReplaceVistaIcon.exe executable.dll icon.ico [icon_ID [language_code]]

Note: If you have an exe file with multiple icons, Windows Explorer uses the first icon as the application icon when browsing folders or in start menu. Compile your application with an XP-compatible icon and then replace it using the tool. Although the tool is able to add new icon into an executable, it would add it at the end of icon list and Windows Explorer would ignore it.

Conclusion

If you have experience with Vista icons in other build environments such as gcc, Delphi, or Builder, please share your knowledge and add a comment below.

Resources

RealWorld Icon Editor homepage.


Recent Comments

Display all comments.

Anonymous
on February 18th 2008
what about the source code?
Anonymous
on February 18th 2008
what about the license?
Vlasta
on February 19th 2008
it can be used for free and source code is on codeproject.com
Anonymous
on October 20th 2008
In Delphi 2009 you are able to chose which resource compiler you want to use. If you select the "Microsoft resource compiler" from Delphi, you will be able to compile Vista icons in your Delphi app without any extra work.
Anonymous
on February 10th 2009
Install the latest Microsoft Windows SDK - http://www.microsoft.com/downloads/details.aspx?FamilyID=4377f86d-c913-4b5c-b87e-ef72e5b4e065&displaylang=en
then run VCIntegrate. This should fix the Vista compilation problem
Anonymous
on May 6th 2009
This tool (ReplaceVistaIcon) works fine, but it does break our debugging process. Since our EXEs are created with VB6 (don't ask), we have to use ReplaceVistaIcon by hand. Then the EXE's modification date doesn't match the PDB's modification date, and the debugger won't recognize the symbols. An option to preserve the modification date would be useful to us...
Vlasta
on May 7th 2009
I have put the source code for this tool to CodeProject web site. It should not be hard to add the date preservation bits. (Or can you just debug without the icons?)
Anonymous
on January 5th
Your program puts in padding stuff like "PADDINGXX". I think it is much smarter to pad with zeroes (will compress better anyway).

As for Delphi 2009, Delphi 2010, C Builder 2009, C Builder 2010 - the built in resource compiler can build programs with Borland Resource Compiler (brcc32.exe) and with Windows SDK Resource Compiler they both work but ONLY for uncompressed icons.

Vista 256x256 icon features PNG compression and Delphi/Borland compiler seems to have issues with PNG compressed icons. So if you use tools like IcoFX, RealWorld Icon Editor or IconWorkshop to create your icons, you must remember to turn of PNG compression support for 256x256 icons otherwise you will be able to compile them into your application but they will not be shown properly on Vista / Win7.

Having uncompressed icon will increase your application size of course, but if you are packing it with some compressor later (zip, rar, nsis installer...) it will actually compress better so it will be larger file when installed but smaller when in installer archive if you use uncompressed icon (although, this is not a rule, PNG compression can sometimes make things smaller).
Telecetera
on January 15th
Thanks to all contributors, we should have solved our problem, but haven't.

We use D2007 on W7 64-bit. We grabbed a working, resizable icon from the desktop using IcoFx, switch off PNG compression and saved it. Added it as the only icon to a simple Delphi app using Project\Options\Application\Icon, then ran ReplaceVistaIcon ourapp.exe savedicon.ico, and could see the resultant increase in size. Noting comments about replacing versus adding, we also tried adding 0 and 1 as a third parameter.

No dice, any ideas?
Vlasta
on January 15th
Caching in Explorer? Try making a copy of the exe after running the tool...

Copyright © 2005-2010 RealWorld Graphics. Contact: info@rw-designer.com.