| Rapid-Q Documentation by William Yu (c)1999 | Chapter 8 |
|
| |
$RESOURCE ICO_TEST AS "C:\ICONS\TEST.ICO"
DIM Form AS QForm
Form.ICOHandle = ICO_TEST
'Form.Icon = "C:\ICONS\TEST.ICO"
The file C:\ICONS\TEST.ICO is embedded within your executable, which means
you don't need to include TEST.ICO if you plan on distributing your .EXE
program. Rapid-Q doesn't generate .RES files for you, and it can't handle other
people's .RES files either. Most languages you'll see have a .RES file, but you
can't use them in Rapid-Q, you'll have to extract the pictures within it, and
use the $RESOURCE handle directive to include them in your application. It is
also possible to do this: Form.ICOHandle = ICO_TEST
DIM Image AS QImage
Image.Icon = Form.Icon
Image.Icon normally accepts a string value, but if no string is specified,
it'll read the previously cached icon. In this case, we're loading Form.Icon to
our "cache" and Image.Icon will read from it. So what does this do? Image.Icon = Form.Icon + Form2.IconThis will load Form2.Icon into the cache, so Image.Icon will copy Form2.Icon. However, please note that you can't assign Icon Handles, for example:
Image.IcoHandle = Form.IcoHandleThe parser will try to look for a resource handle, but won't find one.
DIM ImageList AS QImageList
ImageList.Width = 32
ImageList.Height = 32
ImageList.AddICOFile("app.ico")
ImageList.AddBMPFile("app.bmp", 0)
You can add icons or bitmaps in any order. As before, you can also add
images from the "cache" if no filename was specified. As before: ImageList.AddICOFile(Form.Icon)
ImageList.AddICOFile(ImageList.GetICO(0))
$RESOURCE Bomb_WAV AS "BOMB.WAV"
PlayWav(Bomb_WAV, 1) '-- 1 = background play
SLEEP 5 '-- Wait until wav is finished
As for other types, you can extract the resource to be manipulated. $RESOURCE Whatever_TYPE AS "text.txt"
ExtractResource(Resource(0), "text.txt")
After you're done using it, you can simply delete the file. There are a
wide range of uses for extracting resources, you can even use this technique in
an installation program. For more information on EXTRACTRESOURCE, RESOURCE, and
RESOURCECOUNT, please see Appendix C: Other reserved keywords | Prev Chapter | Contents | Next Chapter |