
you want to get. Passing in 0 for instance gives you access to built-in
Windows icons.
Y u can also load an icon from a file:o
TIcon(HINSTANCE instance, char far* filename, int index);
In this case, instance should be the instance of the current module, filename
is the name of the file containing the icon, and index is the index of the icon
to be retrieved.
Y u can also create a new icon:o
TIcon(HINSTANCE instance, TSize& size, int planes, int bitsPixel,
void far* andBits, void far* xorBits);
In this case, instance should be the instance of the current module, size
indicates the size of the icon, planes indicates the number of color planes,
bitsPixel indicates the number of bits per pixel, andBits points to an array
containing the AND mask of the icon, and xorBits points to an array
containing the XOR mask of the icon. The andBits array must specify a
monochrome mask. The xorBits array can be a monochrome or device-
dependent color bitmap.
Y u can also create a new TIcon object from an existing HICON handle:o
TIcon(HICON handle, TAutoDelete autoDelete = NoAutoDelete);
This constructor is used to obtain an ObjectWindows object as an alias to a
regular Windows handle received in a message.
There are two other constructors that are available only for 32-bit
applications:
32
TIcon(const void* resBits, DWORD resSize);
TIcon(const ICONINFO* iconInfo);
The first constructor takes two parameters: resBits is a pointer to a buffer
containing the icon data bits (usually obtained from a call to
LookupIconIdFromDirectory or LoadResource functions) and resSize indicates
the number of bits in the resBits buffer.
The second constructor takes a single parameter an ICONINFO structure.,
The constructor creates an icon from the information in the ICONINFO
structure. The fIcon member of the ICONINFO structure must be TRUE,
indicating that the ICONINFO structure contains an icon.
~TIcon deletes the icon and its storage space.
Chapter 13, Graphics objects
317