Important: The information in this document is obsolete and should not be used for new development.
GetMaxResourceSize
You can use theGetMaxResourceSize
function to get the approximate size of a resource. TheGetMaxResourceSize
function is also available as theMaxSizeRsrc
function.
FUNCTION GetMaxResourceSize (theResource: Handle): LongInt;
theResource
- Handle to a resource.
DESCRIPTION
LikeGetResourceSizeOnDisk
,GetMaxResourceSize
takes a handle and returns the size of the corresponding resource. However,GetMaxResourceSize
does not check the resource on disk; instead, it either checks the resource size in memory or, if
the resource is not in memory, calculates its size, in bytes, on the basis of information
in the resource map in memory. This gives you an approximate size for the resource that you can count on as the resource's maximum size. It's possible that the resource is actually smaller than the offsets in the resource map indicate because the file has not yet been compacted. If you want the exact size of a resource on disk, either callGetResourceSizeOnDisk
or callUpdateResFile
before callingGetMaxResourceSize
.If the value of the
theResource
parameter isn't a handle to a valid resource,GetMaxResourceSize
returns -1, andResError
returns the result coderesNotFound
.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 a description of the
UpdateResFile
andGetResourceSizeOnDisk
routines, see page 1-87 and page 1-99, respectively.