[rel] Aveicon Library

A while ago, I was searching for a way to create ICO files. Since ICONs are supported natively by the Windows Operating System, I thought there was an API for it: no. You have to do everything on your own to make an ICO-file.

It took me some time to find out how to do it and even more time to make the writing functions and to debug 'm. The result was AveIconifier. Anyhow, I decided to put the functions inside a library, because I figured more coders might want to make ICO files.

I might add some more functions in the future, currently there are 3 functions available:

  • OpenIconFile, creates an ICO file where entries can be written to
  • WriteIconEntry, writes an entry to the icon file, one only need to provide HBITMAPS
  • CloseIconFile, closes the ICO file and flushes it to disk

Download

http://mpj.tomaatnet.nl/aveiconlib.zip

How to use

I assume you know how to add the lib/headers to your project, so I only provide a code snippet on how to use the functions:

ICONFILE iconFile = {0};
strcpy(iconFile.filename,"c:/test.ico");
iconFile.numberOfEntries = 2;

if(!OpenIconFile(&iconFile))
  throw new std:: exception("Error when trying to create ICO file");

CREATEICONENTRY entry = {0};
entry.entryNum = 0;          // first entry in this ICO file
entry.hColor = hBitmapColor; // some pre-created HBITMAP
entry.hMask = hBitmapMask;   // some pre-created HBITMAP that is a mask, must be in 1bpp format
entry.lColors = 0xFFFFFFFF;  // we want to use 32 bit colors

WriteIconEntry(&iconFile,&entry);

CREATEICONENTRY entry2 = {0};
entry2.entryNum = 1;           // second entry in this ICO file
entry2.hColor = hBitmapColor2; // some pre-created HBITMAP
entry2.hMask = hBitmapMask2;   // some pre-created HBITMAP that is a mask, must be in 1bpp format
entry2.lColors = 0xFFFFFFFF;   // we want to use 32 bit colors

WriteIconEntry(&iconFile,&entry2);

CloseIconFile(&iconEntry);

#205025

sweeeeeeeet :)

siwu

#205243