Creating a Resource-Definition File

After creating individual resource files for your application's dialog box and icon resources, you create a resource-definition file, or script. A script is a text file with the extension .RC.

The script lists every resource in your application and describes some types of resources in great detail. For a resource that exists in a separate file, such as an icon or cursor, the script names the resource and the file that contains it. For some resources, such as a menu, the entire definition of the resource exists within the script.

A script file can contain the following information:

The following example shows a script file that defines the resources for an application named Shapes:

#include "SHAPES.H"

ShapesCursor CURSOR SHAPES.CUR
ShapesIcon ICON SHAPES.ICO

    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. Custom cursors are not available in Visual Fortran.

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.

Once you create the resource-definition script (RC) file, use the Resource Compiler Command Line to create the RES file.

For details about script files, see the online Platform SDK sections under "Windows Programming Guidelines" and "Platform SDK Tools" such as "Using the Resource Compiler."