Hi,
Windows Vista's new icon format (where individual device images can be PNG images) doesn't get along very well with some applications, including ones I've written and ones I use.
The way the PNG data is stored is causing problems -- it is not backwards compatible with the documented icon resource format. When my program examines the icon data to get the dimensions and color depth, Vista's icons have raw PNG data here, so my program ends up thinking the icon is 169478669 x 109051904 pixels, and 389715300-bit color depth. When Microangelo, an icon editing program that I use, opens a .ico file with a PNG image in it, it allocates a huge amount of memory and freezes up.
Is this going to be fixed I would hope that the Windows team can come up with a way of storing icons that is backward compatible but still allows PNG to be used.
Thanks,
PatriotB

PNG Icon format
Sk8tz
Since a PNG is not a BMP it cannot use a BITMAPINFOHEADER structure. You can look at the cbSize member of the BITMAPINFOHEADER to see whether it is sizeof(BITMAPINFOHEADER) - indicating that what follows is a BMP - or the PNG signature - indicating that what follows is a PNG.
Clearly all apps that parse ICO files and resources will have to be updated to support PNGs since that is a new feature. You can check the cbSize to see whether you have a BMP or PNG. (Who knows maybe future versions of the ICO file will support other image formats... in which case you get to update your app again.)
If all you care about is the image meta-data (height, width, color depth) you can get that from the ICONDIRECTORY.
It's not clear to me what you're asking for.
Jagadesh
bobwilmes
Thanks for your response. My app is based on the IconPro sample and the "Icons in Win32" article at http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnwui/html/msdn_icons.asp.
The problem with Windows Vista icons is that there is no BITMAPINFOHEADER. According to the article:
"For each ICONDIRENTRY, the file contains an icon image. The dwBytesInRes member indicates the size of the image data. This image data can be found dwImageOffset bytes from the beginning of the file, and is stored in the following format:
(end quote)
The problem is that PNG device images don't have this structure, they have the raw PNG data right here; thus there is no BITMAPINFOHEADER to check for validity. I will have to code my app to explicitly check for PNG data.
The article does start off with the disclaimer "Internal details discussed in this article are subject to change without notice in future versions of Windows." So, I don't fault Microsoft for making a breaking change like this. I understand that there probably isn't any good way to add this functionality without breaking SOMEthing.
jnousis
MuratO
Also, thanks Raymond for all the time you put into these forums and your blog -- it is much appreciated!