The basic concepts involved with using resource files are as follows:
in a resource file, define structs or use appropriate pre-defined structs and then define resources that use those structs.
run the resource compiler to produce both a generated header file and a resource file. The generated header file defines the symbols which a program uses to refer to the resources.
A program which wishes to use the resource file then does the following:
it includes the generated header file in the appropriate source file to get symbolic access to the ids of the resources contained within the file
opens a RResourceFile
object, specifying the
generated resource file name
reads any resource it wishes; the resource is identified by a
symbolic id which has been #define
d as a number; the content of
the resource is read into a binary descriptor, derived from
TDesC8
.
converts the binary descriptor into whatever target format is appropriate for the data in the resource file
discards the descriptor, if appropriate, when the binary descriptor has been fully converted into its target format
closes the RResourceFile
when all operations on the
resource file are complete
The resource text can be changed and the resources recompiled without altering or recompiling the C++ program. For example, to alter the language used by text strings.