Compiling compressed Windows Vista icons
Compiling compressed Windows Vista icons
RealWorld Graphics logo    
Not logged in.  
IndexSoftwareGraphicsArticlesDiscussMore...

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
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

Find quality web sites in our directory of Graphics Resources

Tutorials, App Developer, Research, Online Services, Web Design

Select background

I wish there were ...

Is the speed of this web adequate?

   

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 July 2nd 2007
So I did the rcdll.dll trick and that didn't work. Could there be a difference since Visual Studio 8 is running on my XP system and not on Vista? I also have two icons, embedded in EXE so thus a challenge...
Vlasta
on July 3rd 2007
Do you have a SP1 for VS2005 installed? That enables compilation of vista icons, but not usage from IDE. That's what the rcdll.dll trick(?) is for.
msdner
on December 2nd 2007
good article

reference:
http://www.msdner.com/windows-networking/
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?)

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