Solved

ICON FIle format

Posted on 2000-03-22
4
169 Views
Last Modified: 2013-11-20
Hi can someone tell about window ICON file format. What structure they use for ICON file header.
Thanks in advance.
0
Comment
Question by:kaushikg
  • 2
4 Comments
 
LVL 11

Expert Comment

by:mikeblas
ID: 2647910
See the ICOPRO sample on MSDN for very complete examples of dealing with icon files.

But, in the meantime, the header looks like this:

WORD dwReserved; // must be 0
WORD dwType; // must be 1
UINT uImages; // count of images (normally 1)

and then the RGB bits follow.

..B ekiM
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 2647916

Here's a more complete description of the whole file's structure:

typedef struct
{
    WORD           idReserved;   // Reserved (must be 0)
    WORD           idType;       // Resource Type (1 for icons)
    WORD           idCount;      // How many images?
    ICONDIRENTRY   idEntries[1]; // An entry for each image
} ICONDIR, *LPICONDIR;

The ICONDIRENTRY structure is defined like this:

typedef struct
{
    BYTE        bWidth;          // Width, in pixels, of the image
    BYTE        bHeight;         // Height, in pixels, of the image
    BYTE        bColorCount;     // Number of colors in image (0 if >=8bpp)
    BYTE        bReserved;       // Reserved ( must be 0)
    WORD        wPlanes;         // Color Planes
    WORD        wBitCount;       // Bits per pixel
    DWORD       dwBytesInRes;    // How many bytes in this resource?
    DWORD       dwImageOffset;   // Where in the file is this image?
} ICONDIRENTRY, *LPICONDIRENTRY;

Then, the real RGB information is in there like a regular bitmap:

typdef struct
{
   BITMAPINFOHEADER   icHeader;      // DIB header
   RGBQUAD         icColors[1];   // Color table
   BYTE            icXOR[1];      // DIB bits for XOR mask
   BYTE            icAND[1];      // DIB bits for AND mask
} ICONIMAGE, *LPICONIMAGE;


..B ekiM
0
 
LVL 23

Expert Comment

by:chensu
ID: 2647917
0
 

Author Comment

by:kaushikg
ID: 2648295
Thanks mike and chensu for your valuable help.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
WinWaitActive parameters 12 31
move a line in eclipse 3 60
fizzArray2 challenge 1 61
matchUp  challenge 9 72
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now