You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 01418c8
Browse filesBrowse the repository at this point in the historyBrowse files
When you create a new resource or resource object, the development environment assigns it a default symbol name, for example, IDD_DIALOG1. You can use the [Properties Window](/visualstudio/ide/reference/properties-window) to change the default symbol name or to change the name of any symbol already associated with a resource.
13
11
14
12
For symbols associated with a single resource, you can also use the **Properties** window to change the symbol value. You can use the [Resource Symbols dialog box](../windows/resource-symbols-dialog-box.md) to change the value of symbols not currently assigned to a resource.
15
13
16
14
Normally all symbol definitions are saved in `Resource.h`. However, you may need to change this include filename so that you can, for example, work with more than one resource file in the same directory.
17
15
18
-
For information on adding resources to managed projects, please see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*.
16
+
For information on adding resources to managed projects, see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*.
17
+
18
+
> [!NOTE]
19
+
> If your project doesn't already contain an .rc file, see [Creating a New Resource Script File](../windows/how-to-create-a-resource-script-file.md).
19
20
20
-
###Symbol name restrictions
21
+
## Symbol name restrictions
21
22
22
23
The restrictions on symbol names are as follows:
23
24
24
25
- All [symbols](../windows/symbols-resource-identifiers.md) must be unique within the scope of the application. This prevents conflicting symbol definitions in the header files.
25
26
26
27
- Valid characters for a symbol name include A-Z, a-z, 0-9, and underscores ( _ ).
27
28
28
-
- Symbol names cannot begin with a number and are limited to 247 characters.
29
+
- Symbol names can't begin with a number and are limited to 247 characters.
29
30
30
-
- Symbol names cannot contain spaces.
31
+
- Symbol names can't contain spaces.
31
32
32
-
- Symbol names are not casesensitive, but the case of the first symbol definition is preserved. The header file that defines the symbols is used by both the resource compiler/editor and C++ program(s) to refer resources defined in a resource file. For two symbol names that differ only in case, the C++ program will see two separate symbols while the resource compiler/editor will see both names as referring to one single symbol.
33
+
- Symbol names aren't case-sensitive, but the case of the first symbol definition is preserved. The header file that defines the symbols is used by both the resource compiler/editor and C++ program(s) to refer resources defined in a resource file. For two symbol names that differ only in case, the C++ program will see two separate symbols while the resource compiler/editor will see both names as referring to one single symbol.
33
34
34
35
> [!NOTE]
35
36
> If you do not follow the standard symbol name scheme (ID*_[keyword]) outlined below, and your symbol name happens to be the same as a keyword known to the resource script compiler, trying to build the resource script file will result in seemingly random error generation that is difficult to diagnose. To prevent this, adhere to the standard naming scheme.
@@ -45,20 +46,17 @@ Symbol names have descriptive prefixes that indicate the kind of resource or obj
45
46
|Strings|IDS_|String in the string table|
46
47
|MFC|AFX_|Reserved for predefined MFC symbols|
47
48
48
-
### To change a resource's symbol name (ID)
49
+
### To change a symbol name (ID)
49
50
50
51
1. In [Resource View](../windows/resource-view-window.md), select the resource.
51
52
52
-
> [!NOTE]
53
-
> If your project doesn't already contain an .rc file, please see [Creating a New Resource Script File](../windows/how-to-create-a-resource-script-file.md).
54
-
55
53
1. In the **Properties** window, type a new symbol name or select from the list of existing symbols in the **ID** box.
56
54
57
-
If you type a new symbol name, it is automatically assigned a value.
55
+
If you type a new symbol name, it's automatically assigned a value.
58
56
59
57
You can use the [Resource Symbols dialog box](../windows/resource-symbols-dialog-box.md) to change the names of symbols not currently assigned to a resource.
60
58
61
-
###Symbol value restrictions
59
+
## Symbol value restrictions
62
60
63
61
A symbol value can be any integer expressed in the normal manner for #define preprocessor directives. Here are some examples of symbol values:
64
62
@@ -71,84 +69,65 @@ A symbol value can be any integer expressed in the normal manner for #define pre
71
69
72
70
Symbol values for resources (accelerators, bitmaps, cursors, dialog boxes, icons, menus, string tables, and version information) must be decimal numbers in the range from 0 to 32,767 (but cannot be hexadecimal). Symbol values for parts of resources, such as dialog box controls or individual strings in the string table, can be from 0 to 65,534 or from -32,768 to 32,767.
73
71
74
-
Resource symbols are 16bit numbers. You may enter them as signed or unsigned, however, they are used internally as unsigned integers. So negative numbers will be cast to their corresponding positive value.
72
+
Resource symbols are 16-bit numbers. You may enter them as signed or unsigned, however, they're used internally as unsigned integers. So negative numbers will be cast to their corresponding positive value.
75
73
76
74
Here are some limitations of symbol values:
77
75
78
76
- The Visual Studio development environment and MFC use some number ranges for special purposes. All numbers with the most significant bit set (-32,768 to -1 or 32,768 to 65,534, depending on sign) are reserved by MFC.
79
77
80
-
- You cannot define a symbol value using other symbol strings. For example, the following symbol definition is not supported:
78
+
- You can't define a symbol value using other symbol strings. For example, the following symbol definition isn't supported:
81
79
82
80
```cpp
83
81
#defineIDC_MYEDIT IDC_OTHEREDIT //not supported
84
82
```
85
83
86
-
- You cannot use preprocessor macros with arguments as value definitions. For example:
84
+
- You can't use preprocessor macros with arguments as value definitions. For example:
87
85
88
86
```cpp
89
87
#define IDD_ABOUT ID(7) //not supported
90
88
```
91
89
92
-
is not a valid expression regardless of what `ID` evaluates to at compile time.
90
+
isn't a valid expression regardless of what `ID` evaluates to at compile time.
93
91
94
92
- Your application may have an existing file containing symbols defined with expressions. For more information on how to include the symbols as read-only symbols, see [Using Shared (Read Only) or Calculated Symbols](../windows/including-shared-read-only-or-calculated-symbols.md).
95
93
96
94
For more information on number ranges, see [TN023: Standard MFC Resources](../mfc/tn023-standard-mfc-resources.md).
97
95
98
-
### To change a symbol value assigned to a single resource or object
96
+
### To change a symbol value
99
97
100
98
1. In [Resource View](../windows/resource-view-window.md), select the resource.
101
99
102
-
> [!NOTE]
103
-
> If your project doesn't already contain an .rc file, please see [Creating a New Resource Script File](../windows/how-to-create-a-resource-script-file.md).
104
-
105
100
1. In the **Properties** window, type the symbol name followed by an equal sign and an integer in the **ID** box, for example:
106
101
107
102
```
108
103
IDC_EDITNAME=5100
109
104
```
110
105
111
-
The new value is stored in the symbol header file the next time you save the project. Only the symbol name remains visible in the ID box; the equal sign and value are not displayed after they are validated.
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
## To change the name of the resource symbol header file
106
+
The new value is stored in the symbol header file the next time you save the project. Only the symbol name remains visible in the ID box; the equal sign and value aren't displayed after they're validated.
120
107
121
-
1. In [Resource View](../windows/resource-view-window.md), right-click your .rc file and choose [Resource Includes](../windows/resource-includes-dialog-box.md) from the shortcut menu.
122
-
123
-
> [!NOTE]
124
-
> If your project doesn't already contain an .rc file, please see [Creating a New Resource Script File](../windows/how-to-create-a-resource-script-file.md).
125
-
126
-
1. In the **Symbol header file** box, type the new name for the include file.
127
-
128
-
129
-
# Changing or Deleting Unassigned Symbols
108
+
## Change or delete unassigned symbols
130
109
131
110
While in the [Resource Symbols dialog box](../windows/resource-symbols-dialog-box.md), you can edit or delete existing symbols that aren't already assigned to a resource or object.
132
111
133
-
## To change an unassigned symbol
112
+
### To change an unassigned symbol
134
113
135
114
1. In the **Name** box, select the unassigned symbol, and choose **Change**.
136
115
137
116
1. Edit the symbol's name or value in the boxes provided in the **Change Symbol** dialog box.
138
117
139
118
> [!NOTE]
140
-
> To change a symbol that *is* assigned to a resource or object, you must use the resource editor or **Properties** window. For more information, see [Changing a Symbol or Symbol Name](../windows/changing-a-symbol-or-symbol-name-id.md).
119
+
> To change a symbol that *is* assigned to a resource or object, you must use the resource editor or **Properties** window.
141
120
142
-
## To delete an unassigned (unused) symbol
121
+
### To delete an unassigned (unused) symbol
143
122
144
123
In the [Resource Symbols dialog box](../windows/resource-symbols-dialog-box.md), select the symbol that you want to delete, and choose **Delete**.
145
124
146
125
> [!NOTE]
147
126
> Before deleting an unused symbol in a resource file, make sure it is not used elsewhere in the program or by resource files included at compile time.
148
127
149
-
# Including Shared (Read-Only) or Calculated Symbols
128
+
## Include shared (read-only) or calculated symbols
150
129
151
-
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 dialog box](../windows/resource-includes-dialog-box.md) to add additional read-only symbol header files.
130
+
The first time the development environment reads a resource file created by another application, it marks all included header files as read-only. Though you can use the [Resource Includes dialog box](../windows/resource-includes-dialog-box.md) to add additional read-only symbol header files.
152
131
153
132
One reason you may want to use read-only symbol definitions is for symbol files that you plan to share among several projects.
154
133
@@ -174,24 +153,27 @@ The environment will correctly interpret these calculated symbols as long as:
174
153
175
154
1. In [Resource View](../windows/resource-view-window.md), right-click your .rc file and choose [Resource Includes](../windows/resource-includes-dialog-box.md) from the shortcut menu.
176
155
177
-
> [!NOTE]
178
-
> If your project doesn't already contain an .rc file, please see [Creating a New Resource Script File](../windows/how-to-create-a-resource-script-file.md).
179
-
180
156
1. 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.
181
157
182
-
Do not call the file `Resource.h`, since that is the filename normally used by the main symbol header file.
158
+
Don't call the file `Resource.h`, since that is the filename normally used by the main symbol header file.
183
159
184
160
> [!NOTE]
185
161
> **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.
186
162
187
-
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.
163
+
Use the **Read-only symbol directives** box to include files with symbol definitions only. Don't include resource definitions; otherwise, duplicate resource definitions will be created when the file is saved.
188
164
189
165
1. Place the symbols in the file you specified.
190
166
191
-
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.
167
+
The symbols in files included in this way are evaluated each time you open your resource file, but they aren't replaced on the disk when you save your file.
192
168
193
169
1. Select **OK**.
194
170
171
+
### To change the name of the resource symbol header file
172
+
173
+
1. In [Resource View](../windows/resource-view-window.md), right-click your .rc file and choose [Resource Includes](../windows/resource-includes-dialog-box.md) from the shortcut menu.
174
+
175
+
1. In the **Symbol header file** box, type the new name for the include file.
0 commit comments