IconPro Version 1.0
IconPro Icon Manager

IconPro is designed to manipulate icons having images with bit depths from 1bpp to 32bpp, as well as sizes from 16x16 to 128x128.

IconPro provides no editing capabilities. To create an icon, the user must first edit the image in DIB format, using a program like PBRUSH. Then the image can be imported into IconPro without loss of bit depth.

Note that IconPro restricts the size of its child windows, so MDI tiling can look different than expected.

When extracting icons from DLL and EXE files, IconPro will operate only on 32bit files.

On current versions of NT, icons may look distorted due to the fact that current versions of NT do not support variable sized icons.

How to use IconPro

More Information on Icons in Win32


IconPro Usage

IconPro displays icons in MDI child windows, showing you one image at a time. Since an icon may contain more than one image, a list box is provided below the display area to choose which image to look at.

IconPro is capable of reading and writing ICO files, as well as extracting icons from Win32 PE format DLLs and EXEs. It can also import from/export to BMP files and copy/paste with the clipboard.

To set the transparent color , left-click on the XOR mask while holding the <ctrl> key down.

Menu Options

File

New Icon

Open Icon File

Extract From DLL/EXE

Close

Save ICO File

Save As ICO File

Exit

Edit

Copy

Paste

Stretch Paste

Import BMP

Stretch Import BMP

Export BMP

Add Format

Remove Format

Window

Arrange Icons

Cascade

Tile Horizontal

Tile Vertical

Help

Contents

About


Icons in Win32

Icon images are stored in ICO files and as resources in EXEs and DLLs in near DIB format - a BITMAPINFO followed by XOR bits followed by AND bits. A block of memory like this can be passed to CreateIconFromResourceEx() to create a HICON from the resource. This API expects the bmiHeader.biHeight member of the BITMAPINFO to be the sum of the heights of the XOR and AND masks. Further, this API is not implemented on NT at this time, so CreateIconFromResource() must be used instead.

When creating the AND mask for an icon (or any transparent BitBlt), a simple method is to BitBlt from the source image to a mono bitmap and let GDI do the conversions based on SetBkColor(). This will not work with DIBSections. Any BitBlt'ing with DIBSections results in color mapping without regard to the background color.

DIBSections can not be used in the ICONINFO structure passed to CreateIconIndirect(). DDBs must be used there.

Currently, during the icon selection process in Windows 95, all bit depths >= 8 are treated as equal. Therefore, it is pointless to have both a 24bpp and an 8bpp image in the same ICO file. When running in any video mode of at least 8bpp, Windows will simply choose the first one.


 ICO File Format

Icons are normally stored in ICO files. The ICO file format is documented in the Windows 3.1 SDK Programmer's Reference, Volume 4: Resources, Chapter 1: Graphics File Formats.

The ICO file starts with an ICONDIR structure. The ICONDIR structure is defined as:

typedef struct

{

WORD	idReserved;   // Reserved

WORD	idType;       // resource type (1 for icons)

WORD	idCount;      // how many images?

ICONDIRENTRY	idEntries[1]; // entries for each image (idCount of 'em)

} ICONDIR, *LPICONDIR;

The ICONDIRENTRY structure is defined as:

typedef struct

{

BYTE	bWidth;               // Width of the image

BYTE	bHeight;              // Height of the image (times 2)

BYTE	bColorCount;          // Number of colors in image (0 if >=8bpp)

BYTE	bReserved;            // Reserved

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;

So, the file consists of the header followed by the bits for each image. The bits for each image can be located by seeking to dwImageOffset in the file. The format of the bits follows:

The bits for each image are stored in something similar to CF_DIB format. First is a BITMAPINFO structure, followed by the DIB bits of the XOR mask, followed by the DIB bits of the AND mask.

Note the following two caveats:

1) The bmiHeader.biHeight member of the BITMAPINFO structure indicates the height of the XOR mask plus the height of the AND mask.

2) The AND mask is monochrome, and has no BITMAPINFO.


New Icon
 File->New Icon

This command creates a new icon resource and a window in which to display it. The newly created icon resource has no images in it. New images would need to be created using the “Edit->Add Format” command.


Open Icon
 File->Open Icon File

This command opens an ICO file and creates a new window in which to display its images. The images stored in the ICO file are enumerated in the listbox at the bottom of the display window.


Extract from DLL/EXE
File->Extract From DLL/EXE

This command extracts an icon resource from a 32bit DLL or EXE file. (It will fail on 16bit files). If the file contains more than one icon resource, a dialog is shown allowing the choice of which icon resource to extract.


Close
File->Close

This command closes the current icon resource child window. If the image has been modified, a dialog will be shown asking whether to save changes.


Save ICO File
File->Save ICO File

This command saves the current icon resource to its ICO file.


Save As ICO File
File->Save As ICO File

This command saves the current icon resource to a newly named ICO file.


Exit
File->Exit

This command terminates IconPro.


Edit Copy
Edit->Copy

This command causes the XOR mask of the current icon resource’s current image to be placed on the clipboard in CF_DIB format.


Edit Paste
Edit->Paste

This command takes the CF_DIB format image from the clipboard and uses it to replace the XOR mask of the current icon resource’s current image. If the clipboard image is larger than the current icon image, only the corner of the image is used. If the clipboard image is smaller than the current icon image, some of the resultant icon image may be black or undefined.


Stretch Paste
Edit->Stretch Paste

This command takes the CF_DIB format image from the clipboard and uses it to replace the XOR mask of the current icon resource’s current image, stretching it to fit the dimensions of the icon image.


Import BMP
Edit->Import BMP

This command reads a BMP file and uses it to replace the XOR mask of the current icon resource’s current image. If the BMP bitmap is larger than the current icon image, only the corner of the image is used. If the BMP bitmap is smaller than the current icon image, some of the resultant icon image may be black or undefined.


Stretch Import BMP
Edit->Stretch Import BMP

This command reads a BMP file and uses it to replace the XOR mask of the current icon resource’s current image, stretching it to fit the dimensions of the icon image.


Export BMP
Edit->Export BMP

This command causes the XOR mask of the current icon resource’s current image to be written to a newly named BMP file.


Add Format
Edit->Add Format

This command launches a dialog that allows the creation of a new icon image in the current icon resource. Slider controls are provided to allow the Width, Height, and Color Depth to be chosen. Valid ranges for these values are:

Width: Min 16, Max 128

Height: Min 16, Max 128

Color Depth: Min 1bpp, Max 32bpp

Two images with identical Width, Height and Color Depth are not allowed in the same icon resource.


Remove Format
Edit->Remove Format

This command removes the current icon image from the current icon resource.


Arrange Icons
Window->Arrange Icons

This command arranges the MDI child icons.


Cascade
Window->Cascade

This command arranges the MDI child windows in a cascade effect.


Tile Horizontal
Window->Tile Horizontal

This command horizontally tiles the MDI child windows.


Tile Vertical
Window->Tile Vertical

This command vertically tiles the MDI child windows.


Help Contents
Help->Contents

This command launches help for IconPro.


Help About
Help->About

This command displays the About box.


Setting the Transparent Color

IconPro can recalculate the XOR and AND masks using a given color as a transparent color. This means that any pixel with that color in the XOR mask is treated as transparent when the icon is drawn. This transparent color can be selected in IconPro by holding the <ctrl> key while clicking the left mouse button while the mouse cursor is over a pixel with the appropriate color in the XOR mask.