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 32×32 (and 16×16) 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 48×48. With a standard icon, the 32×32 pixel icon bitmap is stretched to 48×48 (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 48×48, in which case a standard icon is (get this) stretched to 48×48 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 (32×32), medium (48×48, default), and large (96×96) icons. In Computer, the user has additional view options, including tiles (icons shown as 48×48), details and list (16×16), and extra large (256×256). Better yet, there is a sizing slider that allows icon sizes to be set at somewhat arbitrary sizes up to the full size, 256×256 pixels.

Program icons can contain several different image sizes, at different bit depths, and a standard icon usually has 32×32 and 16×16 sizes. Vista makes use of 4 different base icon sizes: 32×32 and 16×16 are the (old) standard sizes, 48×48 is the new default size (stretched up from 32×32 if missing), and 256×256 is the full size (extra large) image that is scaled down to any size larger than 48×48 (replaced with 48×48 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 48×48 and 256×256 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 (256×256) 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 72×72, so programs with Vista icons would not work on Win98 machines. Fortunately, my testing indicates that this is simply false. Of course, the 256×256 icons cannot be displayed on older systems, but they read and recognize the 32×32 (and 16×16) 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.

Leave a Reply

Your email address will not be published.