Using #include Directive with Windows Resource CompilerID: Q80945
|
The Windows Resource Compiler supports many standard C language
preprocessor directives such as "#define" to define symbolic
constants, and "#include" to include header and other resource files.
If an application developed for the Windows environment has more than
one resource, each resource can be maintained in a separate file.
Then, use the #include directive to direct the Resource Compiler to
build all the resources into one output file. Using this technique
prevents one resource file from becoming unmanageably large with an
overwhelming number of resources.
It is important to note that the Resource Compiler treats files with
the .C and .H extensions in a special manner. It assumes that a file
with one of these two extensions does not contain resources. When a
file has the .C or .H file extension, the Resource Compiler ignores
all lines in the file except for preprocessor directives (#define,
#include, and so forth). Therefore, a file that contains resources
that is included in another resource file should not have the .C or .H
file extension.
The following example demonstrates the implications of this situation.
The MSG.H file has the following contents:
/*
* This header file defines message IDs for strings in the
* stringtable resource. All source files can use this header file
* to reference specific strings.
*/
#define STRING1 1
#define STRING2 2
#define STRING3 3
/*
* This file defines the stringtable resource contents for this
* application. It should be included in the application's resource
* file. It requires definitions from the MSG.H header file.
*/
STRINGTABLE
{
STRING1, "This is string 1."
STRING2, "This is string 2."
STRING3, "This is string 3."
}
/*
* This is the "main" resource definition file for this
* application. Among other things, it includes the stringtable
* resource definition from other header files.
*/
RESOURCE 1 (MENU)
RESOURCE 2 (RAW DATA)
...
#include "MSG.H"
#include "STRTABLE.RC"
Additional query words: 3.00 3.10 3.50 4.00 95 win16sdk
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: March 4, 1999