[futurebasic] Re: [FB] Useful Resource Tip

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

From: Sylvain Guillemette <allmedia@...>
Date: Sat, 10 Apr 1999 00:05:53 -0500
>Does this mean that when you open "FRED" in the Resedit or Resorceror
>editor/viewer you see only code and no picture?
>
>=====================
>Mike Malone
>crochety@...
>=====================

Yes.
And you don't need Resorceror to do it.

Steps using Resedit:

1)
In the 'Resource' menu, select 'Create New Resource'.
Enter the resource type you want to create.
Example: SPLH as in 'Splash' screen

2)
In the PICT resource, select the image you want to 'transfer'
and select 'Open Using Hex Editor'.
There you'll see the raw code of the PICT.
Just copy everything to the new resource and that's it !
To copy the code, i think you'll have to copy it by chunks
because when you do a 'Select All', sometimes Resedit
doesn't copy everything. (copy limited to 32k ?)


Alternatively, you can use the following code to do the job
for you. Just modify the params to match your requirements.
Note that you'll have to manually (with Resedit) delete the old
resource type:

'----------------------------------------------------------
WINDOW OFF
OUTPUT FILE "PICT to SPLH"

oldType& = _"PICT"                   '<------Change 'TYPE' here !
newType& = _"SPLH"

resRef% = 0
vRefNum% = 0
F$ = FILES$(1,,, vRefNum%)
LONG IF F$ <> ""
  resRef% = USR OPENRFPERM(F$, vRefNum%, 4)
  LONG IF resRef%
    numRes& = FN COUNT1RESOURCES (oldType&)
    LONG IF numRes& > 0
      FOR X = 1 TO numRes&
        H& = FN GETINDRESOURCE (oldType&, X)
        LONG IF H& <> 0
          CALL GETRESINFO (H&, resID%, type&, resName$)
          CALL DETACHRESOURCE (H&)
          CALL ADDRESOURCE (H&, newType&, resID%, resName$)
          CALL RELEASERESOURCE (H&)
        END IF
      NEXT X
    END IF
    CALL CLOSERESFILE (resRef%)
  END IF
END IF
END
'----------------------------------------------------------
*The code above is from Al Staffieri.

You could also do this with sound ('snd ') resources.
(Don't forget the space after 'snd ')
To play a 'converted' sound, use this:

mySnd& = FN GETRESOURCE(_"SNDS", 128)         '<--- Get the new type
LONG IF mySnd&
   DEFSTR LONG
   snd$ = "&" + MKI$(mySnd&)
   SOUND snd$             '<---Play the sound using standard FB command
END IF


Hope this helps,

Sylvain