Important: The information in this document is obsolete and should not be used for new development.
GetMaxResourceSize
You can use theGetMaxResourceSizefunction to get the approximate size of a resource. TheGetMaxResourceSizefunction is also available as theMaxSizeRsrcfunction.
FUNCTION GetMaxResourceSize (theResource: Handle): LongInt;
theResource- Handle to a resource.
DESCRIPTION
LikeGetResourceSizeOnDisk,GetMaxResourceSizetakes a handle and returns the size of the corresponding resource. However,GetMaxResourceSizedoes 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 callGetResourceSizeOnDiskor callUpdateResFilebefore callingGetMaxResourceSize.If the value of the
theResourceparameter isn't a handle to a valid resource,GetMaxResourceSizereturns -1, andResErrorreturns the result coderesNotFound.RESULT CODES
noErr 0 No error resNotFound -192 Resource not found SEE ALSO
To check for errors, call theResErrorfunction as described on page 1-47.For a description of the
UpdateResFileandGetResourceSizeOnDiskroutines, see page 1-87 and page 1-99, respectively.