A resource script (.RC) file contains statements that define all of the items that will be included in the compiled binary resource file. Each statement describes a resource item, along with an identifier (ID) and any additional parameters (which vary according to the type of resource). A resource script can even reference a resource item that is stored in a separate file, such as a bitmap or icon.
A resource identifier can be numeric in the range 0 to 65535, or alphanumeric. When a PowerBASIC application needs to use a resource from the embedded resource file, it uses the resource's ID to identify it.
There are several ways to create a resource script (.RC) file. The first technique is to write the file by hand, using a text editor like Notepad. This method is quite suitable for creating small resource scripts containing only a handful of statements.
Here is an example of a small handwritten resource script containing an icon and a version information block:
#include "resource.h"
ICON1 ICON "MYICON.ICO"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1, 5, 0, 0
PRODUCTVERSION 1, 5, 0, 0
FILEOS VOS_WINDOWS32
FILETYPE VFT_APP
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "PowerBASIC, Inc.\000"
VALUE "FileDescription", "Program description\000"
VALUE "FileVersion", "01.50.0000\000"
VALUE "InternalName", "MYPROG\000"
VALUE "OriginalFilename", "MYPROG.EXE\000"
VALUE "LegalCopyright", "Copyright (c) 2008 PowerBASIC, Inc.\000"
VALUE "LegalTrademarks", "PowerBASIC is a trademark of PowerBASIC,_
Inc.\000"
VALUE "ProductName", "MYPROG\000"
VALUE "ProductVersion", "01.50.0000\000"
VALUE "Comments", "Example for Windows 95/98/NT/XP/Vista.\000"
END
END
END
This script defines two resource items, whose alphanumeric IDs are ICON1 and VS_VERSION_INFO respectively. In this case, the actual icon binary data is stored in a separate file (MYICON.ICO). During compilation, the resource compiler takes the necessary information from the ICO file and includes it in the binary resource file it creates.
Complete details of the resource script language syntax and features can be found at http://msdn.microsoft.com/en-us/library/aa381042.aspx
See Also