/****************************************************************************\
*
* FILE: Icons.H
*
* PURPOSE: IconPro Project Icon handling header file
*
* COMMENTS:
*
*
* Copyright 1995 - 1998 Microsoft Corp.
*
*
* History:
* July '95 - Created
*
\****************************************************************************/
/****************************************************************************/
// Structs
// These first two structs represent how the icon information is stored
// when it is bound into a EXE or DLL file. Structure members are WORD
// aligned and the last member of the structure is the ID instead of
// the imageoffset.
#pragma pack( push )
#pragma pack( 2 )
typedef struct
{
BYTEbWidth; // Width of the image
BYTEbHeight; // Height of the image (times 2)
BYTEbColorCount; // Number of colors in image (0 if >=8bpp)
BYTEbReserved; // Reserved
WORDwPlanes; // Color Planes
WORDwBitCount; // Bits per pixel
DWORDdwBytesInRes; // how many bytes in this resource?
WORDnID; // the ID
} MEMICONDIRENTRY, *LPMEMICONDIRENTRY;
typedef struct
{
WORDidReserved; // Reserved
WORDidType; // resource type (1 for icons)
WORDidCount; // how many images?
MEMICONDIRENTRYidEntries[1]; // the entries for each image
} MEMICONDIR, *LPMEMICONDIR;
#pragma pack( pop )
// These next two structs represent how the icon information is stored
// in an ICO file.
typedef struct
{
BYTEbWidth; // Width of the image
BYTEbHeight; // Height of the image (times 2)
BYTEbColorCount; // Number of colors in image (0 if >=8bpp)
BYTEbReserved; // Reserved
WORDwPlanes; // Color Planes
WORDwBitCount; // Bits per pixel
DWORDdwBytesInRes; // how many bytes in this resource?
DWORDdwImageOffset; // where in the file is this image
} ICONDIRENTRY, *LPICONDIRENTRY;
typedef struct
{
WORDidReserved; // Reserved
WORDidType; // resource type (1 for icons)
WORDidCount; // how many images?
ICONDIRENTRYidEntries[1]; // the entries for each image
} ICONDIR, *LPICONDIR;
// The following two structs are for the use of this program in
// manipulating icons. They are more closely tied to the operation
// of this program than the structures listed above. One of the
// main differences is that they provide a pointer to the DIB
// information of the masks.
typedef struct
{
UINTWidth, Height, Colors; // Width, Height and bpp
LPBYTElpBits; // ptr to DIB bits
DWORDdwNumBytes; // how many bytes?
LPBITMAPINFOlpbi; // ptr to header
LPBYTElpXOR; // ptr to XOR image bits
LPBYTElpAND; // ptr to AND image bits
} ICONIMAGE, *LPICONIMAGE;
typedef struct
{
BOOLbHasChanged; // Has image changed?
TCHARszOriginalICOFileName[MAX_PATH]; // Original name
TCHARszOriginalDLLFileName[MAX_PATH]; // Original name
UINTnNumImages; // How many images?
ICONIMAGEIconImages[1]; // Image entries
} ICONRESOURCE, *LPICONRESOURCE;
/****************************************************************************/
/****************************************************************************/
// Exported function prototypes
LPICONRESOURCE ReadIconFromICOFile( LPCTSTR szFileName );
BOOL WriteIconToICOFile( LPICONRESOURCE lpIR, LPCTSTR szFileName );
HICON MakeIconFromResource( LPICONIMAGE lpIcon );
LPICONRESOURCE ReadIconFromEXEFile( LPCTSTR szFileName );
BOOL IconImageToClipBoard( LPICONIMAGE lpii );
BOOL IconImageFromClipBoard( LPICONIMAGE lpii, BOOL bStretchToFit );
BOOL CreateBlankNewFormatIcon( LPICONIMAGE lpii );
BOOL DrawXORMask( HDC hDC, RECT Rect, LPICONIMAGE lpIcon );
BOOL DrawANDMask( HDC hDC, RECT Rect, LPICONIMAGE lpIcon );
RECT GetXORImageRect( RECT Rect, LPICONIMAGE lpIcon );
BOOL MakeNewANDMaskBasedOnPoint( LPICONIMAGE lpIcon, POINT pt );
BOOL IconImageFromBMPFile( LPCTSTR szFileName, LPICONIMAGE lpii, BOOL bStretchToFit );
BOOL IconImageToBMPFile( LPCTSTR szFileName, LPICONIMAGE lpii );
/****************************************************************************/