Resource Files
Many applications use external files, such as data files and image files, that must be distributed with the application. Having such files reside on the user's PC can be an issue in at several ways. Users may be tempted to edit the files, possibly making the files unusable by the PowerBASIC application. Or, the update of an application is complicated by the presence of multiple application files.

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.

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.