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
![]() | 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.
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 icon with Vista image format. Large resolution makes it possible to add an additional effect - a projected shadow.
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".
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.
RealWorld Icon Editor homepage.
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
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...
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?)
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).
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?
Caching in Explorer? Try making a copy of the exe after running the tool...
Can you provide a link to the source code? I can't find it in codeproject.
I use delphi 2007.. and have windows 7 x64... I have the icons working like this..
I use icoFX to create a multi layer icon.. eg the different size icons are in one .ico file.. 256x256, 48x48, 32x32 and 16x16. Save as 159.ico.
Create a new resource script file (resources\setup.rc) and add:
#define ICON_1 159
ICON_1 ICON "159.ico"
Compile script with rc.exe
Comment out the default resource file (.RES) from your delphi project file (PROJECT/VIEW SOURCE), and add your new one created from the .rc file that has the icon info in it.
//{$R *.res}
{$R .\resources\setup.res}
This stops delphi from using the default icon definded in the project.
Then add this line after Application.Initialiation;
Application.Icon.Handle := LoadIcon( hInstance, '#159' );
Windows Vista and 7 can now display what ever icon it wants.
Hope this helps..
Is there any information available on the return codes for replaceVistaIcon?
the usual - 0=success, 1=failure
Find out how Vista icons differ from XP icons.
See how RealWorld Icon Editor handles Vista icons.