[futurebasic] Re: [FB] Using PICT and sound files

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

From: Rick Brown <rbrown@...>
Date: Wed, 09 Jun 1999 19:49:14 -0500

Jeffrey Schwartz wrote:

> I'm writing an application that needs to open and display PICT files (not resources) and open and play sound files (not resources).
>
> The Handbook gives a pretty thorough description of how to open a PICT file and read the PICT into memory associated with a handle.  How can I display this PICT?  Can I use PICTURE FIELD as I do with PICT resources?  Do I have to use CALL DRAWPICTURE or PICTURE and worry about updates myself?

Once you have a handle to the picture, you can display it using either PICTURE FIELD or DRAWPICTURE/PICTURE.  To display it using PICTURE FIELD, use this syntax:

    PICTURE FIELD pfID, &pictHandle&, ...

As you probably know, if you do it this way, the field is self-refreshing.  If you use DRAWPICTURE or PICTURE, you'll need to handle refreshes yourself.

>
> And how can I play a sound from a sound file?  Most of the sound files I've seen have the sound as a 'snd  ' resource number 128 so I could just get the resource from the file.  But it seems that not all sound files use 128.  Is there a more general way?

I've noticed that the name of the resource tends to be the same as the name of the file.  If you can count on that being true, then you can use GETNAMEDRESOURCE or GET1NAMEDRESOURCE to get the resource based on its name.  Another thing you can try, if you're sure there is only one "snd "
resource in the file, is this:

    handle& = FN GETINDRESOURCE(_"snd ", 1)

That will get the first "snd " resource found, regardless of its resource ID or name.  There's an analogous function, FN GET1INDRESOURCE, which will look only in the current resource file.

- Rick