So far in this chapter, all writing and reading of data has basically been at the level of individual bytes. You can read and write these bytes as numbers and strings, but interpreting them is ultimately up to you. However, there are some types of data where mere bytes won’t do you any good. Therefore, REALbasic also stands ready to translate between a few standard data formats and its own datatypes.
A type 1 System 7 sound is a
To obtain such a resource as a REALbasic Sound object that REALbasic
can play, send a ResourceFork the GetSound message, handing it the
resource’s ID as a parameter.
If the resource lives in a System 7
file (of type
"sfil/movr"), you can save a step;
send a FolderItem the OpenAsSound message.
Unfortunately, the GetSound message assumes that you know the
'snd' resource’s ID number. Often, this is
just what you don’t know; you know its
name instead. In such a case, you’ll have to cycle through all
'snd' resources, looking for the one with the
right name, in order to obtain its ID number. It’s easy to see
how to do this by adapting the code from the end of Section 21.6.2, earlier in this chapter.
See Chapter 26 for more about sounds.
To obtain a
as a REALbasic Picture object, send a ResourceFork the GetPicture
message, supplying the resource’s ID, or the GetNamedPicture
message, supplying the resource’s name.
To obtain an icon resource as a REALbasic Picture object, send a ResourceFork ...