Menu

#11 Replace GetResource with Get1Resource

open
nobody
None
5
2003-10-15
2003-10-15
Chris Waco
No

There are a few places in the code where Whisper calls
GetResource. I think that GetResource calls are a bad idea
and should be replaced with Get1Resource calls instead.

Here's why it's bad:
ZCursorSpinner::SetCursor( ... ) {
acurRsrc = (AcurRecordHandle) GetResource('acur',
newID);
}

If a document file's resource fork is open when SetCursor()
is called, the application will load that cursor instead of the
one in the application itself.

Same problem with MAlias::MAlias( ResID ).

How I would change things:
Write a GetApplicationResource() routine and use it for
items that should be in the application resource fork.

For resources that might be in documents or other files, add
a "ResFileRefNum" parameter to the calls. So the MAlias
constructor will look like:

MAlias::MAlias( ResFileRefNum, ResID )

Discussion


Log in to post a comment.

MongoDB Logo MongoDB