|
This note discusses some problems with the Resource Manager and how to work
around them.
[Jun 01 1986]
|
OpenResFile Bug
This section of the note formerly described a bug in OpenResFile on
64K ROM machines. Information specific to 64K ROM machines has been deleted
from Macintosh Technical Notes for reasons of clarity.
Back to top
GetMenu and ResErrProc
If your application makes use of ResErrProc (a pointer to a procedure
stored in low-memory global $AF2 ) to detect resource errors, you will
get unexpected calls to your ResErrProc procedure when calling
GetMenu on 128K ROMs. The Menu Manager call GetMenu makes a
call to GetResInfo , requesting resource information about MDEF 0.
Unfortunately, ROMMapInsert is set to FALSE , so this call
fails, setting ResErr to -192 (resNotFound ). This in turn
will cause a call to your ResErrProc , procedure even though the
GetMenu call has worked correctly. This is only a problem if you are
using ResErrProc .
The workaround is to:
- save the address of your
ResErrProc procedure
- clear
ResErrProc
- do a
GetResource call on the MENU resource you want to get
- check to see if you get a nil handle back, if you do, you can handle the error in whatever way is appropriate for your application
- call
GetMenu , and
- when you are done calling
GetMenu , restore ResErrProc
SetResAttrs on read-only resource maps
SetResAttrs does not return an error if you are setting the resource
attributes of a resource in a resource file that has a read-only resource map.
The workaround is to check to see if the map is read-only and proceed from
there:
CONST
MapROBit = 8; {Toolbox bit ordering for bit 7 of low-order byte}
BEGIN
...
attrs:= GetResFileAttrs(refNum);
|
Back to top References
The Resource Manager
The Memory Manager
The Menu Manager
M.OV.GestaltSysenvirons
Back to top
Downloadables
|
Acrobat version of this Note (40K).
|
Download
|
|