Solved

ICON FIle format

Posted on 2000-03-22
4
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 113
Unix / Linux grid computing 5 171
How to know only "File created" with EventLog 3 35
withoutTen challenge 14 140
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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

734 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