Resource files may consist of comments, C++ pre-processor statements, and structure statements indicated by predefined keywords.
For more information on the format of resource files, see Resource file source format.
For a commented example of a resource file, see Resource management example: HelloWorldBasic.
A resource file has the following structure:
You can use either C (/* */) or C++ (//) style comments.
For more information on the lexical conventions of resource files, see Lexical conventions.
The first non-comment statement in a resource must be the NAME statement. The syntax is as follows:
NAME name
where name is a 4 letter ID that is unique in the application. This ID is used to differentiate and access resource files when an application uses multiple resource files.
For more information on the NAME statement, see NAME statement.
The resource compiler supports a set of pre-processor statements, including:
#define
#include
#ifdef
#ifndef
#if
#else
#endif
For more information on the supported pre-processor statements, see C++ pre-processor statements.
Typically, resource files contain #includes statements for the following files:
appinfo.rh
avkon.rh
avkon.rsg
eikon.rh
These files are located under the /Epoc32/include folder. They contain the structure declarations for commonly used data structures in the Symbian platform.
The RESOURCE keyword is used to declare a resource in a resource file. The syntax is as follows:
RESOURCE <STRUCT_NAME> | <resource_name> | { <resource-initialiser-list> }
where:
<STRUCT_NAME> is the name of a declared data structure in an included resource header file.
<STRUCT_NAME> must be in upper case.
resource_name identifies the resource .
resource_name must be in lower case.
resource-initialiser-list contains the values the members of the structure should be initialized with when the default values should not be used.
RESOURCE statements may include resources defined within other resource statements in the resource file. For example:
RESOURCE EIK_APP_INFO { menubar = r_name; }
uses a resource declared in a later statement to define its menu bar. For more information, seeEIK_APP_INFO.
Resource statements may also included nested resource structures. For example:
RESOURCE MENU_PANE r_name2 { items = { MENU_TITLE { menu_pane = r_name3; } }; }
For more information on the MENU_PANE resource see , Menu bar resource statements.
For more information on structures, see:
For more on resource statements, see: