Important: The information in this document is obsolete and should not be used for new development.
GetResAttrs
You can use theGetResAttrs
function to get a resource's attributes.
FUNCTION GetResAttrs (theResource: Handle): Integer;
theResource
- A handle to a resource.
DESCRIPTION
Given a handle to a resource, theGetResAttrs
function returns the resource's attributes as recorded in its entry in the resource map in memory. If the value of thetheResource
parameter isn't a handle to a valid resource,GetResInfo
does nothing, and theResError
function returns the result coderesNotFound
.The
GetResAttrs
function returns the resource's attributes in the low-order byte of the function result. Each attribute is identified by a specific bit in the low-order byte. If the bit corresponding to an attribute contains 1, then that attribute is set; if the bit contains 0, then that attribute is not set. You can use these constants to refer to each attribute:
CONST resSysHeap = 64; {set if read into system heap} resPurgeable = 32; {set if purgeable} resLocked = 16; {set if locked} resProtected = 8; {set if protected} resPreload = 4; {set if to be preloaded} resChanged = 2; {set if to be written to resource fork}TheresSysHeap
attribute indicates whether the resource is read into the system heap (resSysHeap
attribute is set to 1) or your application's heap (resSysHeap
attribute is set to 0).If the
resPurgeable
attribute is set to 1, the resource is purgeable; if it's 0, the resource is nonpurgeable.Because a locked resource is nonrelocatable and nonpurgeable, the
resLocked
attribute overrides theresPurgeable
attribute. If theresLocked
attribute is 1, the resource is nonpurgeable regardless of whetherresPurgeable
is set. If it's 0, the resource is purgeable or nonpurgeable depending on the value of theresPurgeable
attribute.If the
resProtected
attribute is set to 1, your application can't use Resource Manager routines to change the resource ID or resource name, modify the resource contents, or remove the resource from its resource fork. However, you can use theSetResAttrs
procedure to remove this protection.If the
resPreload
attribute is set to 1, the Resource Manager reads the resource's resource data into memory immediately after opening its resource fork. You can use this setting to make multiple resources available for your application as soon as possible, rather than reading each one into memory individually. If both theresPreload
attribute and theresLocked
attribute are set, the Resource Manager loads the resource as low in the heap as possible.If the
resChanged
attribute is set to 1, the resource has been changed; if it's 0, the resource hasn't been changed. This attribute is used only while the resource map is in memory. TheresChanged
attribute must be 0 in the resource fork on disk.RESULT CODES
noErr 0 No error resNotFound -192 Resource not found SEE ALSO
To check for errors, call theResError
function as described on page 1-47.For more information about resource attributes, see "The Resource Map" beginning on page 1-7.
To change a resource's attributes in the resource map in memory, use the
SetResAttrs
procedure. It is described next.