[futurebasic] Re: External Resources

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1997 : Group Archive : Group : All Groups

From: Bill Sanford <bsanford@...>
Date: 24 Nov 97 12:27:05 -0600
jonathan wrote:
>>I am writing an app that uses external resources (actually runs with
the
>>resource file open). Once in a while (phase of moon; etc), the data
goes
>>off to MacsBug. I locked down the handle to the resource I want to
write to
>>the file, so on.

I am also working on an app that uses external code resources.  I too was
having a similar problem.  I found my problem to be that I was calling
the code resource again from within the same code resource.  Since code
resources aren't re-entrant, my app would crash.

Moral of the story...  Code resources created by FB aren't re-entrant...

Another problem is that you must make sure that the file you want to call
the resource in is open and is the current resource file.

Open your resource file before you call it...  I open mine at program
launch and save the refnum in a global.

  gResRefNum% = FN OPENRFPERM(f$,v%,1)

When I call the code resource...

  curResFile% = FN CURRESFILE
  CALL USERESFILE(gResRefNum%)
  CALL "<resType>", resID, returnVar, var1, etc...)
  CALL USERESFILE(curResFile%)

When you quit the program...

  CALL CLOSERESFILE(gResRefNum%)


Hope this helps...

Bill Sanford
Director of Engineering and Operations
--------------------------------------------
KAWE Ch-9 Bemidji  -  KAWB Ch-22 Brainerd
Public TV for Northern and Central Minnesota
**  Visit our web site at www.nmptv.org   **
--------------------------------------------
** Support Your Local Public TV Station!! **
--------------------------------------------