Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 1 - Resource Manager / Resource Manager Reference
Resource Manager Routines / Reading Resources Into Memory


You can use the LoadResource procedure to get resource data after you've called SetResLoad with the load parameter set to FALSE or when the resource is purgeable.

PROCEDURE LoadResource (theResource: Handle);
A handle to a resource.
Given a handle to a resource, LoadResource reads the resource data into memory. If the resource is already in memory, or if the theResource parameter doesn't contain a handle to a resource, then LoadResource does nothing. To determine whether either of these situations occurred, call ResError. If the resource is already in memory, ResError returns noErr; if the handle is not a handle to a resource, ResError returns resNotFound.

If you've changed the resource data for a purgeable resource and the resource is purged before being written to the file, the changes will be lost. In this case, LoadResource rereads the original resource from the file's resource fork. You should use ChangedResource or SetResPurge before calling LoadResource to ensure that changes made to purgeable resources are written to the resource fork.

The LoadResource procedure preserves all registers.

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

For information about the SetResLoad, ChangedResource, and SetResPurge procedures, see page 1-74, page 1-83, and page 1-89, respectively.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996

Get information on Apple products.
Visit the Apple Store online or at retail locations.

Copyright © 2004 Apple Computer, Inc.
All rights reserved. | Terms of use | Privacy Notice