The resource directives are special statements that define actions to perform on the file before it is compiled. The directives can assign values to names, include the contents of files, and control compilation of the file.
#include filename
rcinclude filename
Note: If an rcinclude is to be commented out, the open comment (/*) must appear on the same line as the directive. Filename is an ASCII string. A full path must be given if the file is not in the current directory or in the directory specified by the INCLUDE environment variable. The file extensions .I and .TMP must not be used as these are reserved for system use.
The filename parameter is handled as a C string, and two back-slashes must be given wherever one is expected in the path name (for example, root\\sub.) or, a single forward slash (/) can be used instead of double back-slashes (for example, root/sub.)
Example:
#include "wincalls.h" MENU PenSelect BEGIN MENUITEM "black pen", BLACK_PEN END
Files included in resource script files constants that use #define statements may not include any casting of those constants that are used in the resource script. The resource compiler does not parse this casting syntax. For example, the following statement may not be included:
#define IDBUTTON1 (USHORT) 3
If casting is required for C source compilation, you may use two statements such as:
#define IDBUTTON1 3 #define CSRC_IDBUTTON1 ((USHORT)IDBUTTON1)
name is any combination of letters, digits, or punctuation.
value is any integer, character string, or line of text.
Example:
#define nonzero 1 #define USERCLASS "MyControlClass"
name is any combination of letters, digits, or punctuation.
Example:
#undef nonzero #undef USERCLASS
name is the name to be checked by the directive.
Example:
#ifdef Debug FONT 4 errfont.fnt #endif
name is the name to be checked by the directive.
Example:
#ifndef Optimize FONT 4 errfont.fnt #endif
This directive performs a conditional compilation of the resource file by checking the specified constant-expression. If the constant-expression is nonzero, #if directs the resource compiler to continue processing statements up to the next #endif, #else, or #elif directive, then skip to the statement after the #endif. If the constant-expression is zero, #if directs the compiler to skip to the next #endif, #else, or #elif directive.
constant expression is a defined name, an integer constant, or an expression consisting of names, integers, and arithmetic and relational operators.
Example:
#if Version<3 FONT 4 errfont.fnt #endif
constant expression Is a defined name, an integer constant, or an expression consisting of names, integers, and arithmetic and relational operators.
Example:
#if Version<3 FONT 4 italic.fnt #elif Version<7 FONT 4 bold.fnt #endif
This directive marks an optional clause of a conditional compilation block defined by an #ifdef, #ifndef, or #if directive. The #else directive must be the last directive before #endif.
Example:
#ifdef Debug FONT 4 italic.fnt #else FONT 4 bold.fnt #endif