Preprocessor Directives (Menus and Other Resources)
You can use the directives described in the following table as needed in your resource script. They instruct RC to perform actions or to assign values to names.
Directive | Description |
---|---|
#define | Defines a specified name by assigning it a given value. |
#elif | Marks an optional clause of a conditional-compilation block. |
#else | Marks the last optional clause of a conditional-compilation block. |
#endif | Marks the end of a conditional-compilation block. |
#if | Conditionally compiles the script if a specified expression is true. |
#ifdef | Conditionally compiles the script if a specified name is defined. |
#ifndef | Conditionally compiles the script if a specified name is not defined. |
#include | Copies the contents of a file into the resource-definition file. |
#undef | Removes the definition of the specified name. |
To define symbols for your resource identifiers, use the #define directive to define them in a header file. Include this header both in the resource script and your application source code. Similarly, you define the values for resource attributes and styles by including Windows.h in the resource script.
RC treats files with the .c and .h extensions in a special manner. It assumes that a file with one of these extensions does not contain resources. If a file has the .c or .h file name extension, RC ignores all lines in the file except the preprocessor directives. Therefore, to include a file that contains resources in another resource script, give the file to be included an extension other than .c or .h.
Related topics