[futurebasic] Re: [FB] Resources (Again)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 1999 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Mon, 29 Mar 1999 20:42:57 -0600

Phil Yates wrote:

> Let us say, for example, that I have three resource files - my program,
> ResFile A, and ResFile B.
>
> Now, I can load Resources from my Program (easy) and also from ResFile A.
> But now I want to look into ResFile B, which has _some_ of the same
> resources as ResFile A, but _some_ are missing. If I've loaded Resource 1000
> from ResFile A, and try and load it from ResFile B where it doesn't exist,
> the Mac will give me Res 1000 from ResFile A, because it's still in memory,
> even though I've closed that resource file.
>
> Are you still with me ?
>
> The question is, how do I purge from memory all the Resources I've loaded
> from ResFile A, so that when I try and load Resource 1000 from ResFile B, I
> get notification that the Resource isn't there ? Can I do it all at one go,
> or do I have to do it one by one ? Mostly, they're STR# or PICT Resources,
> and are set purgeable.

This sounds very peculiar.  When you close ResFile "A", the Resource Manager
ought to dispose of all the handles to all of "A"'s resources which had been
loaded into memory.

Now, when a handle is disposed of, it doesn't necessarily mean that the memory
in that block is immediately wiped clean.  It's quite possible that you can
close the resource file, then look into to memory pointed to by [resHndl&]
(even though the value in resHndl& is no longer a valid handle), and still see
the resource's data in there.  Is this perhaps what you're seeing?

If you subsequently do "resHndl& = GETRESOURCE(myType&, 1000)" (and you _know_
that there's no resource 1000 available in any currently open resource file),
then resHndl& ought to get set to zero.  That should serve as your notification
that the resource isn't there.  If this is _not_ what's happening, I'd really
like to see a short demo--that would mean that the Resource Manager is acting
very wacko, according to my understanding.

- Rick