Including Resources in an Application

To display the resources you created with the Dialog Editor and Image Editor in a program, you must bind compiled versions of the resources to the compiled program (Figure 7.1).

The Resource Compiler is called automatically by the Graphical Development Environment when it builds a Windows program.

·To include resources in your Windows application:

1.Create individual resource files for cursors, icons, bitmaps, and dialogs.

2.Create a resource script (.RC) file that describes each resource used by the application.

3.Add the resource script file to the project (.MAK file).

4.Compile the resource script file.

5.Add the compiled resources to the application's compiled executable (.EXE) file.

In the Graphical Development Environment, Steps 4 and 5—compiling and binding to the executable file—usually happen as a single process. Building a Windows application consists of several steps, all of which usually happen automatically:

1.The C Language Compiler compiles all the source files into .OBJ files.

2.The Linker combines all the .OBJ files and library files into a single .EXE or .DLL file.

3.The Resource Compiler checks the project for a resource script file and, if it finds one, compiles the referenced resources into a .RES file.

4.The Resource Compiler binds the .RES file to the .EXE or .DLL file (unless specifically told not to).