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 6 - Component Manager / Component Manager Reference
Routines for Components / Accessing a Component's Resource File


OpenComponentResFile

The OpenComponentResFile function allows your component to gain access to its resource file. This function opens the resource file with read permission and returns a reference number that your component can use to read data from the file. The Component Manager adds the resource file to the current resource chain. Your component must close the resource file with the CloseComponentResFile function before returning to the calling application.

Your component can use FSpOpenResFile or equivalent Resource Manager routines to open other resource files, but you must use OpenComponentResFile to open your component's resource file.

FUNCTION OpenComponentResFile (aComponent: Component): Integer;
aComponent
A component identifier that specifies the component whose resource file you wish to open. Applications that register components may obtain this identifier from the RegisterComponentResource function.
DESCRIPTION
The OpenComponentResFile function returns a reference number for the appropriate resource file. This function returns 0 or a negative number if the specified component does not have an associated resource file or if the Component Manager cannot open the resource file.

Note that when working with resources, your component should always first save the current resource file, perform any resource operations, then restore the current resource file to its previous value before returning.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996