Solved

ICON FIle format

Posted on 2000-03-22
4
171 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add content to output file 4 67
Pressing cancel button with C# UI Automation 3 81
how to monitor remote shell execution on linux 9 104
countEvens challenge 2 111
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

856 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