Important: The information in this document is obsolete and should not be used for new development.
SetResInfo
You can use theSetResInfoprocedure to change the name and resource ID of a resource.
PROCEDURE SetResInfo (theResource: Handle; theID: Integer; name: Str255);
theResource- A handle to a resource.
theID- The new resource ID.
name- The new name or an empty string to preserve the resource name.
DESCRIPTION
Given a handle to a resource,SetResInfochanges the resource ID and the resource name of the specified resource to the values given intheIDandname. If you pass an empty string for thenameparameter, the resource name is not changed. TheSetResInfoprocedure changes the information in the resource map in memory, not in the resource file itself.
If the parameter
- WARNING
- Do not change a system resource's resource ID or name. Other applications may already access the resource and may not work properly if you change the resource ID, resource name, or both.

theResourcedoesn't contain a handle to an existing resource,SetResInfodoes nothing, andResErrorreturns the result coderesNotFound. If
the resource map becomes too large to fit in memory (for example, after an unnamed resource is given a name),SetResInfodoes nothing, andResErrorreturns an appropriate Memory Manager result code. The same is true if the resource data in memory can't be written to the resource fork (for example, because the disk is full). If theresProtectedattribute is set for the resource,SetResInfodoes nothing, andResErrorreturns the result coderesAttrErr.If you want to write changes to the resource map on disk after updating the resource map in memory, call the
ChangedResourceprocedure for the same resource after you callSetResInfo.
- IMPORTANT
- Even if you don't call
ChangedResourceafter usingSetResInfoto change the name and resource ID of a resource, the change may be written to disk when the Resource Manager updates the resource fork. If you callChangedResourcefor any resource in the same resource fork, or if you add or remove a resource, the Resource Manager writes the entire resource map to disk after a call toUpdateResFileor when your application terminates. In these cases, all changes to resource information in the resource map become permanent. If you want any of the changes to be temporary, you should restore the original information before the resource is updated.
SPECIAL CONSIDERATIONS
TheSetResInfoprocedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.RESULT CODES
noErr 0 No error resNotFound -192 Resource not found resAttrErr -198 Attribute does not permit operation SEE ALSO
To check for errors, call theResErrorfunction as described on page 1-47.For a description of the
ChangedResourceandUpdateResFileprocedures, see page 1-83 and page 1-87, respectively.
 
  
  
 