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 / Reading Resources Into Memory


SetResLoad

You can use the SetResLoad procedure to enable and disable automatic loading of resource data into memory for routines that return handles to resources.

PROCEDURE SetResLoad (load: Boolean);
load
A Boolean value that determines whether Resource Manager routines should read resource data into memory. If you set this parameter to TRUE, Resource Manager routines that return handles will, during subsequent calls, automatically read resource data into memory if it is not already in memory; if you set this parameter to FALSE, Resource Manager routines will not automatically read resource data into memory.
DESCRIPTION
Routines that return handles to resources normally read the resource data into memory if it's not already there. The default setting (load = TRUE) maintains this state. If the load parameter is set to FALSE, routines that return handles to resources will not, during subsequent calls, load the resource data into memory. Instead, such routines return a handle whose master pointer is set to NIL unless the resource is already in memory. In addition, when first opening a resource fork the Resource Manager won't load into memory resources whose resPreload attribute is set.

You can use the SetResLoad procedure when you want to read from the resource map without reading the resource data into memory. To read the resource data into memory after a call to SetResLoad, call the LoadResource procedure, which is described next.

WARNING
If you call SetResLoad with the load parameter set to FALSE, be sure to call SetResLoad with the load parameter set to TRUE as soon as possible. Other parts of system software that call the Resource Manager expect this value to be TRUE, and some routines won't work if resources are not loaded automatically.
ASSEMBLY-LANGUAGE INFORMATION
The current value of SetResLoad is stored in the global variable ResLoad.

RESULT CODE
noErr0No error
SEE ALSO
To check for errors, call the ResError function as described on page 1-47.

For more information about the global variable ResLoad, see "Inserting the ROM Resource Map" beginning on page 1-128.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996