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 1 - Resource Manager / Resource Manager Reference
Resource Manager Routines / Getting a Unique Resource ID


UniqueID

You can use the UniqueID function to get a unique resource ID for a resource.

FUNCTION UniqueID (theType: ResType): Integer;
theType
A resource type.
DESCRIPTION
The UniqueID function returns as its function result a resource ID greater than 0 that isn't currently assigned to any resource of the specified type in any open resource fork. You should use this function before adding a new resource to ensure that you don't duplicate a resource ID and override an existing resource.

SPECIAL CONSIDERATIONS
In versions of system software earlier than System 7, the UniqueID function may return a resource ID in the range 0 through 127, which is generally reserved for system resources. You should check that the resource ID returned is not in this range. If it is, call UniqueID again, and continue doing so until you get a resource ID greater than 127.

In System 7 and later versions, UniqueID won't return a resource ID of less than 128.

SEE ALSO
To check for errors, call the ResError function as described on page 1-47.

For more information about restrictions on resource IDs for specific resource types, see "Resource IDs" on page 1-42.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996