WetCode

Untitled

Dec 11th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.60 KB | None | 0 0
  1. The ICO File
  2.  
  3. An Icon file, which usually has the ICO extension, contains one icon resource. Given that an icon resource can contain multiple images, it is no surprise that the file begins with an icon directory:
  4.  
  5. typedef struct
  6. {
  7.     WORD           idReserved;   // Reserved (must be 0)
  8.     WORD           idType;       // Resource Type (1 for icons)
  9.     WORD           idCount;      // How many images?
  10.     ICONDIRENTRY   idEntries[1]; // An entry for each image (idCount of 'em)
  11. } ICONDIR, *LPICONDIR;
  12.  
  13. The idCount member indicates how many images are present in the icon resource. The size of the idEntries array is determined by idCount. There exists one ICONDIRENTRY for each icon image in the file, providing details about its location in the file, size and color depth. The ICONDIRENTRY structure is defined as:
  14.  
  15. typedef struct
  16. {
  17.     BYTE        bWidth;          // Width, in pixels, of the image
  18.     BYTE        bHeight;         // Height, in pixels, of the image
  19.     BYTE        bColorCount;     // Number of colors in image (0 if >=8bpp)
  20.     BYTE        bReserved;       // Reserved ( must be 0)
  21.     WORD        wPlanes;         // Color Planes
  22.     WORD        wBitCount;       // Bits per pixel
  23.     DWORD       dwBytesInRes;    // How many bytes in this resource?
  24.     DWORD       dwImageOffset;   // Where in the file is this image?
  25. } ICONDIRENTRY, *LPICONDIRENTRY;
  26.  
  27. 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:
Advertisement
Add Comment
Please, Sign In to add comment