Share via


Using Shared (Read-Only) or Calculated Symbols

OverviewHow Do I

The first time the development environment reads a resource file created by another application, it marks all included header files as read-only. Subsequently, you can use the Resource Includes command on the View menu to add additional read-only symbol header files.

One reason you may want to use read-only symbol definitions is for symbol files that you plan to share among several projects.

You would also use included symbol files when you have existing resources with symbol definitions that use expressions rather than simple integers to define the symbol value. For example,

#define   IDC_CONTROL1 2100
#define   IDC_CONTROL2 (IDC_CONTROL1+1)

The environment will correctly interpret these calculated symbols as long as:

  • The calculated symbols are placed in a read-only symbols file.

  • Your resource file contains resources to which these calculated symbols are already assigned.

To include shared (read-only) symbols in your resource file

  1. From the View menu, choose Resource Includes.

  2. In the Read-only symbol directives box, use the #include compiler directive to specify the file where you want the read-only symbols to be kept. (You should not call the file Resource.h, since that is the filename normally used by the main symbol header file.)

    Important   What you type in the Read-Only Symbol Directives box is included in the resource file exactly as you type it. Make sure what you type does not contain any spelling or syntax errors.

    You should use the Read-only symbol directives box to include files with symbol definitions only. Do not include resource definitions; otherwise, duplicate resource definitions will be created when the file is saved.

  3. Place the symbols in the file you specified.

    The symbols in files included in this way are evaluated each time you open your resource file, but they are not replaced on the disk when you save your file.

  4. Click OK.