Resource files are a way to solve this problem. A resource file is simply a single file which stores the content of many other files.
Even more useful is PowerBASIC's ability to embed a resource file into the EXE as well as being able to read content from the resource file just as though there it was a standalone file.
Microsoft language applications also use resource files, but uses a different file format (*.res) than is needed by PowerBASIC applications (*.pbr). The PowerBASIC IDE, however, is able to convert Microsoft resource files to the PowerBASIC format.
Resource Script File (*.RC)
The good news is that both Microsoft and PowerBASIC use the same format for creating resource scripts - which are text files that list the resources to be placed in the resource file.
The text file is called a resouce script and uses a *.rc extension.
While both PowerBASIC and Microsoft both use the same format for *.rc script file formats, the format is owned by Microsoft. Documentation and tools for creating resource files must be downloaded from Microsoft's MSDN's Resource Compiler page.
Creating a Resource File
Even better news is that creating resource files that meet the needs of most PowerBASIC programmers can be done manually, using the PowerBASIC IDE as a text editor and using the file formats described in the next few paragraphs.
There are at least 3 common uses for resource files - storing images, storing application version information, and storing tables of string data.
add icon "add.ico" bigger icon "bigger.ico" blank icon "blank.ico" bold icon "bold.ico" car icon "car.ico" 004 icon "check.ico" 006 icon "copy.ico" cowgirl bitmap "cowgirl.bmp" crop icon "crop.ico"
Column 1 is the name, or number, of the resource. PowerBASIC supports both types of resource identifiers, so a programmer is free to use either type on each resource.
Column two is the type of resource. Since PowerBASIC only supports icons and bitmaps, there are only two values you can use.
Column three is the file name, relative to the *.rc file that has been opened in the PowerBASIC IDE.
Compiling the Resource Script
To compile a resource script (*.rc), simply open it in the PowerBASIC IDE, then select "Compile and Run" just as though an EXE was to be created.
The PowerBASIC IDE will recognize the *.rc file extension and run it's resource compiler utilities. Both *.res (Microsoft format) and *.pbr (PowerBASIC format) files will be created.
Embedding Resource Files
A resource file may be included in an application by using the #Resource compiler directive, as in the following snippet from a PowerBASIC application.
#Compile Dll #Dim All #Resource "prime.pbr"
In this example, the #Resource line tells the compiler to embed the resource file "prime.pbr" into the compiled EXE. Once the compiler is run, the *.pbr file will be contained in the EXE file, ready to be accessed.
If you have any suggestions or corrections, please let me know.