FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

RESOURCES

Hide PICT resources


I had a bunch of PICT resources that I didn't want anyone to muck about with, or copy, etc.
I'd been trying to work out a way of converting these to another non-obvious resource type, and even went as far as starting to write a conversion program. As far as I know, ResEdit doesn't allow you to change resource types.
But the feature is already is Resourcerer. Just select all the PICT resources, and change them to the new Resource identifier, such as "FRED". Then use GETRESOURCE or GET1RESOURCE instead of GETPICTURE.
Easy Peasy.
Phil

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
Sylvain