| Home
| Previous
| Next
| Up

MGL_loadIcon

Load an icon file from disk.

Declaration

icon_t * MGLAPI MGL_loadIcon(
const char *iconName,
ibool loadPalette)

Prototype In

mgraph.h

Parameters

iconName | Name of icon file to load
loadPalette | True if the palette should also be loaded

Return Value

Pointer to the loaded icon file, NULL on error.

Description

Locates the specified icon file and loads it into memory. MGL can load any Windows 3.x style icon files of any dimensions. Generally icon files will be either 32x32 or 64x64 in size. Consult the Windows SDK documentation for the format of Windows font files.

If loadPalette is true, the palette values for the icon will be loaded into the structure as well (if there is no palette, it will not be loaded), otherwise the palette entry for the bitmap will be NULL.

When MGL is searching for icon files it will first attempt to find the files just by using the filename itself. Hence if you wish to look for a specific icon file, you should pass the full pathname to the file that you are interested in. If the filename is a simple relative filename (i.e. “MYICON.ICO”), MGL will then search in the ICONS directory relative to the path specified in mglpath variable that was passed to MGL_init. As a final resort MGL will also look for the files in the ICONS directory relative to the MGL_ROOT environment variable.

If the icon file was not found, or an error occurred while reading the icon file, this function will return NULL. You can check the MGL_result error code to determine the cause.

See Also

MGL_unloadIcon, MGL_availableIcon, MGL_putIcon, MGL_loadIconExt

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com