2.2.2 Multiline Statements

A multiline resource-definition statement can begin with any of the following keywords:

Keyword Description

ACCELERATORS Defines menu accelerator keys.
DIALOG Defines a template that an application can use to create dialog boxes.
MENU Defines the appearance and function of an application menu.
RCDATA Defines data resources. Data resources let you include binary data directly into the executable file.
STRINGTABLE Defines string resources. String resources are null-terminated ASCII strings that can be loaded from the executable file.

2.2.2.1 Directives

The following directives can be used as needed in the resource-definition file to instruct RC to perform actions or to assign values to names:

Keyword 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 Carries out conditional compilation if a specified expression is true.
#ifdef Carries out conditional compilation if a specified name is defined.
#ifndef Carries out conditional compilation if a specified name is not defined.
#include Copies the contents of a file into the resource-definition file before RC processes the latter.
#undef Removes the current definition of the specified name.

2.2.2.2 Sample Resource-Definition File

The following example shows an .RC file that defines the resources for an application named Shapes:

#include "SHAPES.H"

ShapesCursor  CURSOR  SHAPES.CUR
ShapesIcon    ICON    SHAPES.ICO

ShapesMenu    MENU
    BEGIN
        POPUP "&Shape"
            BEGIN
                MENUITEM "&Clear", ID_CLEAR
                MENUITEM "&Rectangle", ID_RECT
                MENUITEM "&Triangle", ID_TRIANGLE
                MENUITEM "&Star", ID_STAR
                MENUITEM "&Ellipse", ID_ELLIPSE
            END
    END

The CURSOR statement names the application's cursor resource ShapesCursor and specifies the cursor file SHAPES.CUR, which contains the image for that cursor.

The ICON statement names the application's icon resource ShapesIcon and specifies the icon file SHAPES.ICO, which contains the image for that icon.

The MENU statement defines an application menu named ShapesMenu, a pop-up menu with five menu items.

The menu definition, enclosed by the BEGIN and END keywords, specifies each menu item and the menu identifier that is returned when the user selects that item. For example, the first item on the menu, Clear, returns the menu identifier ID_CLEAR when the user selects it. The menu identifiers are defined in the application header file, SHAPES.H.

For more information about resource-definition files, the syntax of resource statements, and how to define your own resources, see the Microsoft Windows Programmer's Reference, Volume 4.