Important: The information in this document is obsolete and should not be used for new development.
RemoveResource
You can use theRemoveResourceprocedure to remove a resource's entry from the current resource file's resource map in memory. TheRemoveResourceprocedure is also available as theRmveResourceprocedure.
PROCEDURE RemoveResource (theResource: Handle);
theResource- A handle to a resource.
DESCRIPTION
Given a handle to a resource in the current resource file,RemoveResourceremoves the resource entry (resource type, resource ID, resource name, if any, and resource attributes) from the current resource file's resource map in memory.The
RemoveResourceprocedure doesn't immediately release the memory occupied by the resource data; instead, the Resource Manager releases the memory when your application quits, when you callUpdateResFile, or when you callCloseResFile(which in turn callsUpdateResFile). If theresProtectedattribute for the resource is set or if thetheResourceparameter doesn't contain a handle to a resource,RemoveResourcedoes nothing, andResErrorreturns the result codermvResFailed.
If you want to release the memory before updating or closing the resource fork, call the Memory Manager procedure
- IMPORTANT
- If you've removed a resource, the Resource Manager writes the entire resource map when it updates the resource fork, and all changes made to the resource map become permanent. If you want any of the changes to be temporary, you should restore the original information before the Resource Manager updates the resource fork.
![]()
DisposeHandleafter you callRemoveResource.SPECIAL CONSIDERATIONS
TheRemoveResourceprocedure 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 rmvResFailed -196 RemoveResourceprocedure failedSEE ALSO
To check for errors, call theResErrorfunction as described on page 1-47.For descriptions of the
AddResourceandUpdateResFileprocedures, see page 1-85 and page 1-87, respectively. TheCloseResFileprocedure is described next.For more information about the Memory Manager procedure
DisposeHandle, see Inside Macintosh: Memory.