Vista program icons
There are significant changes to program icon handling in Vista.
When I first started Windows Vista, I did not anticipate any differences regarding program icons. Although I had heard that larger icon sizes were supported, my expectations were that our traditional 32x32 (and 16x16) icons would continue to work fine. Technically, they work correctly, insofaras they are displayed and do not cause the program to malfunction, of course. However, changes in Vista render standard icons insufficient.
The first, and most obvious, change is that the default icon size on the Vista desktop is 48x48. With a standard icon, the 32x32 pixel icon bitmap is stretched to 48x48 (125% larger), which looks pretty bad in most cases. Of course, the icon sizes can be changed, and smaller settings are fine. However, a user may select a larger size than 48x48, in which case a standard icon is (get this) stretched to 48x48 and then surrounded by a frame of the desired icon size. Note that Vista does not leave the icon at the designed size, but rather stretches it to ugly first, and then puts a box around it for emphasis.
There are two places where icons are commonly displayed: 1) the desktop and 2) Windows Explorer, now known simply as 'Computer'. On the desktop, the user can select from small (32x32), medium (48x48, default), and large (96x96) icons. In Computer, the user has additional view options, including tiles (icons shown as 48x48), details and list (16x16), and extra large (256x256). Better yet, there is a sizing slider that allows icon sizes to be set at somewhat arbitrary sizes up to the full size, 256x256 pixels.
Program icons can contain several different image sizes, at different bit depths, and a standard icon usually has 32x32 and 16x16 sizes. Vista makes use of 4 different base icon sizes: 32x32 and 16x16 are the (old) standard sizes, 48x48 is the new default size (stretched up from 32x32 if missing), and 256x256 is the full size (extra large) image that is scaled down to any size larger than 48x48 (replaced with 48x48 in a frame if missing). Fortunately, Vista fully supports 32-bit icon images (as does Windows XP) and scaling down from the full size works well.
Obviously, in order to have decent looking program icons, then, one needs to add 48x48 and 256x256 icons to the main icon resource, to handle icons displayed at the default and larger sizes. Indeed, that is the recommendation for Vista program icons, along with providing all four sizes at 32-bit (a.k.a., XP), 256-color, and 16-color bit depths. A quick calculation shows that, while the (9) images for the three smaller sizes take only 19.25K of data, combined, the full size (256x256) icons take 352K of data. To help reduce this overhead, the ICO file format was extended to support PNG compression. This is all described in this good tutorial by Axialis Software; unfortunately, there is one major omission.
Based on the published recommendations, and having received new icon artwork just for the occasion, we licensed an icon editor that supported Vista icons, generated a new .ICO file, and then naively replaced the old standard icon with this new Vista-ready one. All it would take was a quick rebuild and...
error RC2176 : old DIB in vista.ico; pass it through SDKPAINT
No dice (and there is nothing at all on my development system named 'SDKPAINT'). With some frustration, I launch Visual Studio 2005 and (lo and behold!) the latest development environment from Microsoft produces the same error. Really. Some research shows that the only current way to add a proper Vista icon is by adding or replacing an ICON resource to a compiled executable file. Fortunately, make that very fortunately, there is a tool available on The Code Project to do exactly this.
So, with the 'ReplaceVistaIcon' tool installed as a post-processing step to my build (in Visual C++ 6.0), the program builds fine and the icon works as desired in Windows Vista. Tip #1: When updating an existing project, insert two copies of the old standard icon in the program resources. The new Vista icon can replace the first (default), but users will still be able to manually select the older icon if desired. Tip #2: To clear the (aggressive) Vista icon cache, change the default font size (i.e., to or from large fonts). This requires a reboot, but it does the trick.
There was one final concern, that turns out to be a non-issue. In my research, I found reports that Windows 98 would reject any icon that contained images larger than 72x72, so programs with Vista icons would not work on Win98 machines. Fortunately, my testing indicates that this is simply false. Of course, the 256x256 icons cannot be displayed on older systems, but they read and recognize the 32x32 (and 16x16) images just fine. (I did not test this under Windows 95, however.)
Well, there you have the tricks to getting decent program icons under Vista. Once you know them, the process is pretty simple, but finding all the issues takes some time. Hopefully, this article will help you save a little time and avoid the same pitfalls.
When I first started Windows Vista, I did not anticipate any differences regarding program icons. Although I had heard that larger icon sizes were supported, my expectations were that our traditional 32x32 (and 16x16) icons would continue to work fine. Technically, they work correctly, insofaras they are displayed and do not cause the program to malfunction, of course. However, changes in Vista render standard icons insufficient.
The first, and most obvious, change is that the default icon size on the Vista desktop is 48x48. With a standard icon, the 32x32 pixel icon bitmap is stretched to 48x48 (125% larger), which looks pretty bad in most cases. Of course, the icon sizes can be changed, and smaller settings are fine. However, a user may select a larger size than 48x48, in which case a standard icon is (get this) stretched to 48x48 and then surrounded by a frame of the desired icon size. Note that Vista does not leave the icon at the designed size, but rather stretches it to ugly first, and then puts a box around it for emphasis.
There are two places where icons are commonly displayed: 1) the desktop and 2) Windows Explorer, now known simply as 'Computer'. On the desktop, the user can select from small (32x32), medium (48x48, default), and large (96x96) icons. In Computer, the user has additional view options, including tiles (icons shown as 48x48), details and list (16x16), and extra large (256x256). Better yet, there is a sizing slider that allows icon sizes to be set at somewhat arbitrary sizes up to the full size, 256x256 pixels.
Program icons can contain several different image sizes, at different bit depths, and a standard icon usually has 32x32 and 16x16 sizes. Vista makes use of 4 different base icon sizes: 32x32 and 16x16 are the (old) standard sizes, 48x48 is the new default size (stretched up from 32x32 if missing), and 256x256 is the full size (extra large) image that is scaled down to any size larger than 48x48 (replaced with 48x48 in a frame if missing). Fortunately, Vista fully supports 32-bit icon images (as does Windows XP) and scaling down from the full size works well.
Obviously, in order to have decent looking program icons, then, one needs to add 48x48 and 256x256 icons to the main icon resource, to handle icons displayed at the default and larger sizes. Indeed, that is the recommendation for Vista program icons, along with providing all four sizes at 32-bit (a.k.a., XP), 256-color, and 16-color bit depths. A quick calculation shows that, while the (9) images for the three smaller sizes take only 19.25K of data, combined, the full size (256x256) icons take 352K of data. To help reduce this overhead, the ICO file format was extended to support PNG compression. This is all described in this good tutorial by Axialis Software; unfortunately, there is one major omission.
Based on the published recommendations, and having received new icon artwork just for the occasion, we licensed an icon editor that supported Vista icons, generated a new .ICO file, and then naively replaced the old standard icon with this new Vista-ready one. All it would take was a quick rebuild and...
error RC2176 : old DIB in vista.ico; pass it through SDKPAINT
No dice (and there is nothing at all on my development system named 'SDKPAINT'). With some frustration, I launch Visual Studio 2005 and (lo and behold!) the latest development environment from Microsoft produces the same error. Really. Some research shows that the only current way to add a proper Vista icon is by adding or replacing an ICON resource to a compiled executable file. Fortunately, make that very fortunately, there is a tool available on The Code Project to do exactly this.
So, with the 'ReplaceVistaIcon' tool installed as a post-processing step to my build (in Visual C++ 6.0), the program builds fine and the icon works as desired in Windows Vista. Tip #1: When updating an existing project, insert two copies of the old standard icon in the program resources. The new Vista icon can replace the first (default), but users will still be able to manually select the older icon if desired. Tip #2: To clear the (aggressive) Vista icon cache, change the default font size (i.e., to or from large fonts). This requires a reboot, but it does the trick.
There was one final concern, that turns out to be a non-issue. In my research, I found reports that Windows 98 would reject any icon that contained images larger than 72x72, so programs with Vista icons would not work on Win98 machines. Fortunately, my testing indicates that this is simply false. Of course, the 256x256 icons cannot be displayed on older systems, but they read and recognize the 32x32 (and 16x16) images just fine. (I did not test this under Windows 95, however.)
Well, there you have the tricks to getting decent program icons under Vista. Once you know them, the process is pretty simple, but finding all the issues takes some time. Hopefully, this article will help you save a little time and avoid the same pitfalls.

7 Comments:
Thanks for the tip about using the ReplaceVistaIcon program. Ironically, the author of that program says at the bottom of the CodeProject article:
"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."
So much for that. :-)
> error RC2176 : old DIB in
> vista.ico; pass it through SDKPAINT
> No dice (and there is nothing at
> all on my development system named
> 'SDKPAINT')
This bit is interesting since Vista is supposed to be 100% new code. This error was obviously something written in the 1990's when SDKPaint was the tool to use.
The fact that they left it in puts the lie to the "100% new code," and the fact that it refers to an out of date program kind of makes it seem like they didn't even READ this part of the code.
>This error was obviously something written in the 1990's when SDKPaint was the tool to use.
This is true, but...
>The fact that they left it in puts the lie to the "100% new code," and the fact that it refers to an out of date program kind of makes it seem like they didn't even READ this part of the code.
... you cannot pin this one on Vista. This error message came from the resource compilers included in Visual Studio 6 and VS2005, neither of which is part of Vista.
In fact, neither development package is 100% compatible with Vista. :)
It seems the latest beta for Visual Studio 9 fixed this. If you still want to use Visual Studio 8 for your mainstream development, you can install Orcas and copy rcdll.dll from the "Microsoft Visual Studio 9.0/VC/bin" directory to "Microsoft Visual Studio 8/VC/bin". Everything's been working for me so far.
"There was one final concern, that turns out to be a non-issue. In my research, I found reports that Windows 98 would reject any icon that contained images larger than 72x72, so programs with Vista icons would not work on Win98 machines. Fortunately, my testing indicates that this is simply false."
Actually, I wouldn't doubt that information. Icons compiled into an EXE's resource directory and .ICO files are two completely different things. The tool you recommend messes with the resulting EXE binary code - I am extremely leery of tools like ReplaceVistaIcon. Most people don't have a very good grasp on the PE file format. Resource Hacker is about the only tool I would probably trust to modify resources in a PE executable...and that's only because the author had significant experience with PE and spent forever working out the bugs.
> Resource Hacker is about the only tool I would probably trust to modify resources in a PE executable...
Ironically, ResHacker does not support for Vista icons.
Well, perhaps I know little about the PE format and have no experience with PE, and you won't trust me anyway, but our Resource Tuner tool supports replacing large Vista icons stored in EXE as .ICO or .PNG with an icon from a PNG file. But of course, that's just a plug.
I'm working on some icons for a little application I'm writing.
I created an icon in sizes; 16x16, 24x24, 32x32, 48x48, 64x64, 96x96, 128x128 and 256x256. Each tweaked to look good at its own resolution; not just resized.
I found that unless I compressed the 256x256 version Vista would not use it. And nomatter what I do, Vista will not use any sizez between 48x48 - 256x256.
Seeing how the large icons, 96x96, is so often used in Vista I'd like Vista to use the 96x96 version provided in the file. But it doesn't. Not even if I compress all versions over 48x48.
Is there no way of making Vista use the icons between 48x48 - 256x256?
Post a Comment
<< Home