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


Unique1ID

You can use the Unique1ID function to get a resource ID that's unique with respect to resources in the current resource file.

FUNCTION Unique1ID (theType: ResType): Integer;
theType
A resource type.
DESCRIPTION
The Unique1ID 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 the current resource file. You should use this routine 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 Unique1ID 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 Unique1ID again, and continue doing so until you get a resource ID greater than 127.

In System 7 and later versions, Unique1ID 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