13.3 The Resource File

The resource file for Windows applications based on the Microsoft Foundation Class Library is typically the same as the resource file for an equivalent program written without the Microsoft Foundation classes. You normally define your program resources, such as menus and dialog boxes, in a text file (*.RC) that is processed by the Windows resource compiler (RC.EXE) into a binary resource file (*.RES). The binary resource file is combined with your compiled and linked program code to form the final executable file. You can also use the dialog editor to create dialog resources for inclusion in your program.

For example, the About dialog box for the sample program in HELLO.RC is defined by the following text:

AboutBox DIALOG 22, 17, 144, 75

STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU

CAPTION "About Hello"

{

CTEXT "Microsoft Windows" -1, 0, 5, 144, 8

CTEXT "Microsoft Foundation Classes" -1, 0, 14, 144, 8

CTEXT "Hello, Windows!" -1, 0, 23, 144, 8

CTEXT "Version 1.0" -1, 0, 36, 144, 8

DEFPUSHBUTTON "OK" IDOK, 56, 56, 32, 14, WS_GROUP

}

See the example programs provided with the Microsoft Foundation Class Library for sample resource definition files. Also see the Windows Software Development Kit documentation of the resource compiler for more specific information about resource definition formats.