Each icon-resource file starts with an icon directory. The icon directory, defined as an ICONDIR structure, specifies the number of icons in the resource and the dimensions and color format of each icon image. The ICONDIR structure has the following form:
typedef struct ICONDIR {
WORD idReserved;
WORD idType;
WORD idCount;
ICONDIRENTRY idEntries[1];
} ICONHEADER;
Following are the members in the ICONDIR structure:
idReserved
Reserved; must be zero.
idType
Specifies the resource type. This member is set to 1.
idCount
Specifies the number of entries in the directory.
idEntries
Specifies an array of ICONDIRENTRY structures containing information about individual icons. The idCount member specifies the number of structures in the array.
The ICONDIRENTRY structure specifies the dimensions and color format for an icon. The structure has the following form:
struct IconDirectoryEntry {
BYTE bWidth;
BYTE bHeight;
BYTE bColorCount;
BYTE bReserved;
WORD wPlanes;
WORD wBitCount;
DWORD dwBytesInRes;
DWORD dwImageOffset;
};
Following are the members in the ICONDIRENTRY structure:
bWidth
Specifies the width of the icon, in pixels. Acceptable values are 16, 32, and 64.
bHeight
Specifies the height of the icon, in pixels. Acceptable values are 16, 32, and 64.
bColorCount
Specifies the number of colors in the icon. Acceptable values are 2, 8, and 16.
bReserved
Reserved; must be zero.
wPlanes
Specifies the number of color planes in the icon bitmap.
wBitCount
Specifies the number of bits in the icon bitmap.
dwBytesInRes
Specifies the size of the resource, in bytes.
dwImageOffset
Specifies the offset, in bytes, from the beginning of the file to the icon image.