Skip to content

Commit 6e9225a

Browse files
author
msebolt
committed
resource file consolidation pr31
1 parent 9fd9741 commit 6e9225a

7 files changed

Lines changed: 125 additions & 177 deletions

‎.openpublishing.redirection.json‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7715,6 +7715,26 @@
77157715
"redirect_url": "/cpp/windows/sizing-individual-controls",
77167716
"redirect_document_id": false
77177717
},
7718+
{
7719+
"source_path": "docs/windows/changing-the-names-of-symbol-header-files.md",
7720+
"redirect_url": "/cpp/windows/changing-a-symbol-or-symbol-name-id",
7721+
"redirect_document_id": false
7722+
},
7723+
{
7724+
"source_path": "docs/windows/changing-a-symbol-s-numeric-value.md",
7725+
"redirect_url": "/cpp/windows/changing-a-symbol-or-symbol-name-id",
7726+
"redirect_document_id": false
7727+
},
7728+
{
7729+
"source_path": "docs/windows/symbol-value-restrictions.md",
7730+
"redirect_url": "/cpp/windows/changing-a-symbol-or-symbol-name-id",
7731+
"redirect_document_id": false
7732+
},
7733+
{
7734+
"source_path": "docs/windows/symbol-name-restrictions.md",
7735+
"redirect_url": "/cpp/windows/changing-a-symbol-or-symbol-name-id",
7736+
"redirect_document_id": false
7737+
},
77187738
{
77197739
"source_path": "docs/windows/activationfactory-activationfactory-constructor.md",
77207740
"redirect_url": "/cpp/windows/activationfactory-class#activationfactory",

‎docs/windows/TOC.md‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@
3838
#### [Changing Unassigned Symbols](changing-unassigned-symbols.md)
3939
#### [Deleting Unassigned Symbols](deleting-unassigned-symbols.md)
4040
#### [Opening the Resource Editor for a Given Symbol](opening-the-resource-editor-for-a-given-symbol.md)
41-
#### [Changing a Symbol or Symbol Name (ID)](changing-a-symbol-or-symbol-name-id.md)
42-
##### [Symbol Name Restrictions](symbol-name-restrictions.md)
43-
#### [Changing a Symbol's Numeric Value](changing-a-symbol-s-numeric-value.md)
44-
##### [Symbol Value Restrictions](symbol-value-restrictions.md)
45-
#### [Changing the Names of Symbol Header Files](changing-the-names-of-symbol-header-files.md)
41+
#### [Changing a Symbol](changing-a-symbol-or-symbol-name-id.md)
4642
#### [Including Shared (Read-Only) or Calculated Symbols](including-shared-read-only-or-calculated-symbols.md)
4743
#### [Predefined Symbol IDs](predefined-symbol-ids.md)
4844
##### [ATL Predefined Symbols](atl-predefined-symbols.md)
Lines changed: 104 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,127 @@
11
---
2-
title: "Changing a Symbol or Symbol Name (ID)"
2+
title: "Changing a Symbol"
33
ms.date: "11/04/2016"
4-
f1_keywords: ["vc.editors.symbol.changing"]
5-
helpviewer_keywords: ["symbol names", "symbols [C++], names"]
4+
f1_keywords: ["vc.editors.symbol.changing", "vc.editors.symbol.restrictions.name", "vc.editors.symbol.changing.value", "vc.editors.symbol.restrictions.value", "vc.editors.symbol.changing.header"]
5+
helpviewer_keywords: ["symbol names", "symbols [C++], names", "restrictions, symbol names", "numeric values", "symbols [C++], numeric values", "numeric values, changing symbols", "symbols [C++], value restrictions", "restrictions, symbol values", "resource files [C++], multiple", "Resource Includes dialog box [C++]", "symbol header files [C++], changing names", "symbols [C++], symbol header files", "Resource.h"]
66
ms.assetid: 26541832-8dba-4177-b642-e08f94502ea7
77
---
8-
# Changing a Symbol or Symbol Name (ID)
8+
# Changing a Symbol
99

1010
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.
1111

12-
### To change a resource's symbol name
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. For more information, see [Changing Unassigned Symbols](../windows/changing-unassigned-symbols.md).
13+
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.
15+
16+
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*.
17+
18+
## To change a resource's symbol name (ID)
1319

1420
1. In [Resource View](../windows/resource-view-window.md), select the resource.
1521

1622
> [!NOTE]
1723
> 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).
1824
19-
2. In the **Properties** window, type a new symbol name or select from the list of existing symbols in the **ID** box.
25+
1. In the **Properties** window, type a new symbol name or select from the list of existing symbols in the **ID** box.
2026

2127
If you type a new symbol name, it is automatically assigned a value.
2228

2329
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. For more information, see [Changing Unassigned Symbols](../windows/changing-unassigned-symbols.md).
2430

31+
### Symbol name restrictions
32+
33+
The restrictions on symbol names are as follows:
34+
35+
- 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.
36+
37+
- Valid characters for a symbol name include A-Z, a-z, 0-9, and underscores ( _ ).
38+
39+
- Symbol names cannot begin with a number and are limited to 247 characters.
40+
41+
- Symbol names cannot contain spaces.
42+
43+
- Symbol names are not 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.
44+
45+
> [!NOTE]
46+
> 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.
47+
48+
Symbol names have descriptive prefixes that indicate the kind of resource or object they represent. These descriptive prefixes begin with the text combination ID. The Microsoft Foundation Class Library (MFC) uses the symbol naming conventions shown in the following table.
49+
50+
|Category|Prefix|Use|
51+
|--------------|------------|---------|
52+
|Resources|IDR_ IDD_ IDC_ IDI_ IDB_|Accelerator or menu (and associated or custom resources) Dialog box Cursor Icon Bitmap|
53+
|Menu items|ID_|Menu item|
54+
|Commands|ID_|Command|
55+
|Controls and child windows|IDC_|Control|
56+
|Strings|IDS_|String in the string table|
57+
|MFC|AFX_|Reserved for predefined MFC symbols|
58+
59+
## To change a symbol value assigned to a single resource or object
60+
61+
1. In [Resource View](../windows/resource-view-window.md), select the resource.
62+
63+
> [!NOTE]
64+
> 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).
65+
66+
1. In the **Properties** window, type the symbol name followed by an equal sign and an integer in the **ID** box, for example:
67+
68+
```
69+
IDC_EDITNAME=5100
70+
```
71+
72+
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.
73+
74+
### Symbol value restrictions
75+
76+
A symbol value can be any integer expressed in the normal manner for #define preprocessor directives. Here are some examples of symbol values:
77+
78+
```
79+
18
80+
4001
81+
0x0012
82+
-3456
83+
```
84+
85+
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.
86+
87+
Resource symbols are 16 bit 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.
88+
89+
Here are some limitations of symbol values:
90+
91+
- 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.
92+
93+
- You cannot define a symbol value using other symbol strings. For example, the following symbol definition is not supported:
94+
95+
```cpp
96+
#define IDC_MYEDIT IDC_OTHEREDIT //not supported
97+
```
98+
99+
- You cannot use preprocessor macros with arguments as value definitions. For example:
100+
101+
```cpp
102+
#define IDD_ABOUT ID(7) //not supported
103+
```
104+
105+
is not a valid expression regardless of what `ID` evaluates to at compile time.
106+
107+
- 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).
108+
109+
For more information on number ranges, see [TN023: Standard MFC Resources](../mfc/tn023-standard-mfc-resources.md).
110+
111+
## To change the name of the resource symbol header file
112+
113+
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.
114+
115+
> [!NOTE]
116+
> 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).
117+
118+
1. In the **Symbol header file** box, type the new name for the include file.
119+
25120
## Requirements
26121
27122
Win32
28123
29-
## See Also
124+
## See also
30125
31-
[Symbol Name Restrictions](../windows/symbol-name-restrictions.md)<br/>
32-
[Predefined Symbol IDs](../windows/predefined-symbol-ids.md)
126+
[Predefined Symbol IDs](../windows/predefined-symbol-ids.md)<br/>
127+
[Viewing Resource Symbols](../windows/viewing-resource-symbols.md)<br/>

‎docs/windows/changing-a-symbol-s-numeric-value.md‎

Lines changed: 0 additions & 36 deletions
This file was deleted.

‎docs/windows/changing-the-names-of-symbol-header-files.md‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎docs/windows/symbol-name-restrictions.md‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎docs/windows/symbol-value-restrictions.md‎

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)