Important: The information in this document is obsolete and should not be used for new development.
UniqueID
You can use theUniqueID
function to get a unique resource ID for a resource.
FUNCTION UniqueID (theType: ResType): Integer;
theType
- A resource type.
DESCRIPTION
TheUniqueID
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, theUniqueID
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, callUniqueID
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 theResError
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.