Using Windows Vista Icons

Introduction

This article describes the basic differences between Windows XP and Windows Vista icons and explains how to use Vista icons in your applications.

Vista Icons

Four years ago, Microsoft extended the .ico format and allowed 32-bit RGBA images (with an 8-bit alpha channel) inside .ico files. These icons are known as Windows XP icons and are easily recognized by their smooth, antialiased edges.

Beta 1 and Beta 2 of Windows Vista indicate that Microsoft is going to make another change to the .ico format. Icons in current Vista builds differ in two aspects from Windows XP icons:

  • Vista icons contain large, high-resolution, 256x256 images.
  • The large images are stored using PNG compression.

The use of PNG compression is a breaking change. Windows XP and previous are only able to use those images from an icon that are not compressed.

The icon format allowed you to use 256x256 images before, so why did Microsoft introduce the PNG compression? I can only guess, but because the uncompressed icon with all Vista formats occupies more then 400 Kb, the answer is obvious.

Windows Vista Explorer uses the hi-res images and dynamically resamples them to the required resolution.

Problems Compiling Vista Icons

If you try to compile a Vista icon into application resources using the Visual Studio resource compiler, the tool aborts with error and refuses to accept the icon in the Vista format. This error is reported from all versions of Visual Studio, including VS 2005.

How to Use the Tool

The tool accompanying this article is able to replace or add an icon to an already compiled executable. It has an easy command line interface and can be configured to run as a post-build step in Microsoft Visual Studio.

Parameters

ReplaceVistaIcon.exe executable.dll icon.ico [icon_ID [language_code]]

The command will replace or add icon.ico to executable.dll. The icon will be replaced if you specify icon_ID; otherwise, it will be added to the list of icons.

Implementation

The tool does not modify the executable directly. Instead it uses the Win32 API for resource manipulation and works under all NT-based systems. There should be no compatibility problems because it links the static version of C runtime.

The implementation is pretty straightforward. The tool:

  • Reads and analyzes the icon.
  • Enumerates icon resources in the executable. (The icon resource is actually a bit more complicated than other kinds of resources because it consists of an icon directory that holds the references to images, and the actual images.)
  • Optionally removes the icon that is being replaced.
  • Adds the new icon into the executable.

Points of Interest

I used the tool on itself and the compiled executable already contains a Vista-compatible icon (the one on the picture).

Conclusion

Vista is still in its beta phase and Microsoft will likely resolve the problems with the resource compiler by the time Vista is released, thus making this tool obsolete. (What compiler is Microsoft using to compile Windows Vista, anyway?)

Still, Microsoft may not issue a patch for all versions of their development environments and there are plenty of third-party Windows compilers, so the tool may have a place even after Microsoft addresses the issue.

Windows Vista delivers stunning visual capabilities and the new, hi-res icons are an inseparable part of it. Exploring and exploiting the new concepts of Vista is a exciting experience, especially for someone like me, who is involved in development of icon software.



Downloads

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • The mobile market is white hot. Building a well-crafted product development plan that addresses market research, strategy, design, and development will provide the greatest chance for success. Each phase of an app's lifecycle is critical to the its overall success and feeds into the next step of the process of product development for the app. This white paper examines the five key phases of mobile app creation, one by one, to understand how they work together to help create a successful mobile app.

  • On-demand Event Event Date: February 12, 2015 The evolution of systems engineering with the SysML modeling language has resulted in improved requirements specification, better architectural definition, and better hand-off to downstream engineering. Agile methods have proven successful in the software domain, but how can these methods be applied to systems engineering? Check out this webcast and join Bruce Powel Douglass, author of Real-Time Agility, as he discusses how agile methods have had a tremendous …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date