Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 1 - Resource Manager / Resource Manager Reference
Resource Manager Routines / Getting Resource Sizes


GetMaxResourceSize

You can use the GetMaxResourceSize function to get the approximate size of a resource. The GetMaxResourceSize function is also available as the MaxSizeRsrc function.

FUNCTION GetMaxResourceSize (theResource: Handle): LongInt;
theResource
Handle to a resource.
DESCRIPTION
Like GetResourceSizeOnDisk, 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 call GetResourceSizeOnDisk or call UpdateResFile before calling GetMaxResourceSize.

If the value of the theResource parameter isn't a handle to a valid resource, GetMaxResourceSize returns -1, and ResError returns the result code resNotFound.

RESULT CODES
noErr0No error
resNotFound-192Resource not found
SEE ALSO
To check for errors, call the ResError function as described on page 1-47.

For a description of the UpdateResFile and GetResourceSizeOnDisk routines, see page 1-87 and page 1-99, respectively.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996