ReadArray
—reading contents of resource file into
arrayReadArray
is an example of how to load data from
resource files into a class.
It loads the resource identified as SECOND from the resource file; this is an array of DATA structures. (The resource FIRST is not used in this example)
The example constructs a CResDataArray
object to
contain an array of CResData
objects, one for each DATA structure
in the array. The CResDataArray
object can also display the
individual items of each DATA structure at the test console. All WORD, BYTE and
LONG are interpreted as signed values.
The example follows on from the Reading from a resource file example.
ReadData
is an example of how to load data from
resource files into a class.
It loads the resource identified as resource FIRST from the
resource file. This is a simple resource of type DATA. The example constructs a
CResData
object to hold the individual items corresponding to the
items in a DATA structure.
The CResData
object can also display the individual
items at the test console. All WORD, BYTE and LONG data are interpreted as
signed values
ReadText
demonstrates reading text ("hello world!")
from a resource file and writing the text to a console.
SigCheck
is an example of how the signature of a
resource file is checked before it is used.
SigCheck
reads a text string from a single resource
file, SigCheck.rss
, in the standard way and uses
RResourceFile::ConfirmSignatureL()
to check the 'identity' of the
resource file.
MultiRead1
is an example of a class that is capable
of using more than one resource file; MultiRead1
however uses only
a single resource file.
This example, together with MultiRead2 (which uses more than one resource file), shows how to use multiple resource files with cross-referenced resources.
It introduces the class CMultipleResourceFileReader
,
capable of reading resources from multiple resource files.
MultiRead2
shows how to use multiple resource files
with cross-referenced resources. It depends on the resource file created for
the MultiRead1
and SigCheck
projects.
It introduces a second resource file, MultiRead2
,
which contains an LLINK to a resource defined in the
MultiRead1
project. The important point to note is that the effect of introducing this
second resource file is minimal: just another #include file; and the logic in
doExampleL()
would be identical whether the LLINK pointed to
another resource in the same file or a different file.
You must have built MultiRead1 and SigCheck beforehand.
CMultipleResourceFileReader
TResourceReader