Important: The information in this document is obsolete and should not be used for new development.
RemoveResource
You can use theRemoveResource
procedure to remove a resource's entry from the current resource file's resource map in memory. TheRemoveResource
procedure is also available as theRmveResource
procedure.
PROCEDURE RemoveResource (theResource: Handle);
theResource
- A handle to a resource.
DESCRIPTION
Given a handle to a resource in the current resource file,RemoveResource
removes 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
RemoveResource
procedure 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 theresProtected
attribute for the resource is set or if thetheResource
parameter doesn't contain a handle to a resource,RemoveResource
does nothing, andResError
returns 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.
DisposeHandle
after you callRemoveResource
.SPECIAL CONSIDERATIONS
TheRemoveResource
procedure 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 RemoveResource
procedure failedSEE ALSO
To check for errors, call theResError
function as described on page 1-47.For descriptions of the
AddResource
andUpdateResFile
procedures, see page 1-85 and page 1-87, respectively. TheCloseResFile
procedure is described next.For more information about the Memory Manager procedure
DisposeHandle
, see Inside Macintosh: Memory.