Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 5 - Icon Utilities / Icon Utilities Reference
Icon Utilities Routines / Getting Icons From Resources That Don't Belong to an Icon Family


GetIcon

You can use the GetIcon function to get a handle to an icon resource of type 'ICON'.

FUNCTION GetIcon (iconID: Integer): Handle;
iconID
The resource ID for an icon of resource type 'ICON'.
DESCRIPTION
The GetIcon function reads in the 'ICON' resource with the specified resource ID and returns a handle to it. The GetIcon function searches the current resource chain for the resource. If GetIcon finds the resource, it reads the resource and returns a handle to the icon as its function result. If GetIcon can't find the resource, it returns NIL as its function result.

To draw an icon obtained from GetIcon in a specified rectangle, you can use either PlotIcon or PlotIconHandle. Unlike PlotIcon, PlotIconHandle allows you to specify transforms and alignments.

When you are finished using a handle obtained from GetIcon, use the ReleaseResource procedure to release the memory occupied by the icon resource data.

RESULT CODES
noErr0No error
resNotFound-192Resource not found
SEE ALSO
For a description of the PlotIcon procedure and PlotIconHandle function, see page 5-23 and page 5-24, respectively. For information about ReleaseResource, see the chapter "Resource Manager" in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996