[futurebasic] Re: [FB] STR# resource

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

From: AlStaff@...
Date: Fri, 19 Mar 2004 11:49:43 EST
>How do I replace a STR# resource element?
>My app is a PG:PRO project running in OS 9.2.
>PG:PRO has a set of STR# resource functions that don't work in my app.
>I have also tried the following as a test, and it did not work.
>
>a$ = "Test"
>resHandle& = FN NEWHANDLE _clear (2)
>LONG IF resHandle&
>DEF APNDSTR (a$, resHandle&)
>CHANGEDRESOURCE(resHandle&)
>END IF
>
>I can read the resource OK with:
>gStringFromList$ = STR#(5000,1)
>
>The STR# resource has only 1 element and I'm trying to update it with a
>new string but so far all attempts have failed.


I do it like this:

a$ = "Test"
resID = 1001
H& = FN NEWHANDLE _Clear(2)
LONG IF H&
oldH& = FN GET1RESOURCE (_"STR#", resID)
long if oldH&
CALL RMVERESOURCE (oldH&)
CALL UPDATERESFILE (resRef%)
CALL RELEASERESOURCE (oldH&) : oldH& = 0
END IF
DEF APNDSTR (a$, H&)
CALL ADDRESOURCE (H&,_"STR#",resID,"")
CALL UPDATERESFILE (resRef%)
CALL RELEASERESOURCE (H&) : H& = 0
END IF


Al Staffieri Jr.

AlStaff@...
http://members.aol.com/AlStaff/index.html