Skip to content

Commit 8958eba

Browse files
committed
Fix heading style
1 parent 4fbb1d2 commit 8958eba

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

docs/mfc/tn035-using-multiple-resource-files-and-header-files-with-visual-cpp.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
description: "Learn more about: TN035: Using Multiple Resource Files and Header Files with Visual C++"
3-
title: "TN035: Using Multiple Resource Files and Header Files with Visual C++"
2+
description: "Learn more about: TN035: Using multiple resource files and header files with Visual C++"
3+
title: "TN035: Using multiple resource files and header files with Visual C++"
44
ms.date: "11/04/2016"
55
f1_keywords: ["vc.resources"]
66
helpviewer_keywords: ["resource files, multiple", "TN035"]
77
ms.assetid: 1f08ce5e-a912-44cc-ac56-7dd93ad73fb6
88
---
9-
# TN035: Using Multiple Resource Files and Header Files with Visual C++
9+
# TN035: Using multiple resource files and header files with Visual C++
1010

1111
> [!NOTE]
1212
> The following technical note has not been updated since it was first included in the online documentation. As a result, some procedures and topics might be out of date or incorrect. For the latest information, it is recommended that you search for the topic of interest in the online documentation index.
@@ -25,25 +25,25 @@ You should be aware that if you add an additional resource file to your project,
2525

2626
This note is structured to answer the above questions as follows:
2727

28-
- **Overview of How Visual C++ Manages Resource Files and Header Files** provides an overview of how the Resource Set Includes command in Visual C++ lets you use multiple resource files and header files in the same project.
28+
- **Overview of how Visual C++ manages resource files and header files** provides an overview of how the Resource Set Includes command in Visual C++ lets you use multiple resource files and header files in the same project.
2929

3030
- **Analysis of AppWizard-created `.RC` and `.H` Files** looks at the multiple resource and header files that are used by an AppWizard-created application. These files serve as a good model for additional resource files and header files you might want to add to your project.
3131

32-
- **Including Additional Header Files** describes where you might want to include multiple header files, and provides details how to do so.
32+
- **Including additional header files** describes where you might want to include multiple header files, and provides details how to do so.
3333

34-
- **Sharing a Header File Between Two `.RC` Files** shows how you can share one header file between multiple `.RC` files in different projects, or perhaps in the same project.
34+
- **Sharing a header file between two `.RC` files** shows how you can share one header file between multiple `.RC` files in different projects, or perhaps in the same project.
3535

36-
- **Using Multiple Resource Files in the Same Project** describes where you might want to break up your project into multiple `.RC` files, and provides details how to do so.
36+
- **Using multiple resource files in the same project** describes where you might want to break up your project into multiple `.RC` files, and provides details how to do so.
3737

38-
- **Enforcement of Non-Editable Visual C++ Files** describes how you can make sure Visual C++ doesn't edit and unintentionally reformat a custom resource.
38+
- **Enforcement of non-editable Visual C++ files** describes how you can make sure Visual C++ doesn't edit and unintentionally reformat a custom resource.
3939

40-
- **Managing Symbols Shared by Multiple Visual C++-Edited `.RC` Files** describes how to share the same symbols across multiple `.RC` files and how to avoid assigning duplicate ID numeric values.
40+
- **Managing symbols shared by multiple Visual C++-edited `.RC` files** describes how to share the same symbols across multiple `.RC` files and how to avoid assigning duplicate ID numeric values.
4141

42-
- **Managing Dependencies Between `.RC`, `.CPP`, and `.H` Files** describes how Visual C++ avoids unnecessary recompiling `.CPP` files that are dependent on resource symbol files.
42+
- **Managing dependencies between `.RC`, `.CPP`, and `.H` files** describes how Visual C++ avoids unnecessary recompiling `.CPP` files that are dependent on resource symbol files.
4343

44-
- **How Visual C++ Manages Set Includes Information** provides technical details about how Visual C++ keeps track of multiple (nested) `.RC` files and multiple header files that are included by an `.RC` file.
44+
- **How Visual C++ manages Set Includes information** provides technical details about how Visual C++ keeps track of multiple (nested) `.RC` files and multiple header files that are included by an `.RC` file.
4545

46-
## Overview of How Visual C++ Manages Resource Files and Header Files
46+
## Overview of how Visual C++ manages resource files and header files
4747

4848
Visual C++ manages a single `.RC` resource file and a corresponding `.H` header file as a tightly coupled pair of files. When you edit and save resources in an `.RC` file, you indirectly edit and save symbols in the corresponding `.H` file. Although you can open and edit multiple `.RC` files at a time (using Visual C++'s MDI user interface), for any given `.RC` file you indirectly edit exactly one corresponding header file.
4949

@@ -60,17 +60,17 @@ By default, Visual C++ always names the corresponding header file `RESOURCE.H`,
6060
6161
#### Read-Only Symbol Directives
6262

63-
Although Visual C++ only edits one header file for any given `.RC` file, Visual C++ supports references to symbols defined in additional read-only header files. The **Read-Only symbol Directives:** section in the **Resource Includes** dialog lets you specify any number of additional read-only header files as Read-Only Symbol Directives. The "read-only" restriction means that when you add a new resource in the `.RC` file, you can use a symbol defined in the read-only header file. However, if you delete the resource, the symbol still remains defined in the read-only header file. You can't change the numeric value assigned to a read-only symbol.
63+
Although Visual C++ only edits one header file for any given `.RC` file, Visual C++ supports references to symbols defined in additional read-only header files. The **Read-Only Symbol Directives:** section in the **Resource Includes** dialog lets you specify any number of additional read-only header files as Read-Only Symbol Directives. The "read-only" restriction means that when you add a new resource in the `.RC` file, you can use a symbol defined in the read-only header file. However, if you delete the resource, the symbol still remains defined in the read-only header file. You can't change the numeric value assigned to a read-only symbol.
6464

6565
#### Compile-Time Directives
6666

6767
Visual C++ also supports nesting of resource files, where one `.RC` file is included within another by using a `#include` directive. When you edit a given `.RC` file using Visual C++, any resources in the included files aren't visible. But when you compile the `.RC` file, the included files are also compiled. The **Compile-Time Directives:** section in the **Resources Includes** dialog lets you specify any number of `.RC` files to include as Compile-Time Directives.
6868

6969
Note what happens if you read into Visual C++ an `.RC` file that includes another `.RC` file that isn't* specified as a Compile-Time Directive. This situation might arise when you bring to Visual C++ an `.RC` file that you had been previously maintaining manually with a text editor. When Visual C++ reads the included `.RC` file, it merges the included resources into the parent `.RC` file. When you save the parent `.RC` file, the `#include` statement, in effect, will be replaced by the included resources. If you don't want this merge to happen, you should remove the `#include` statement from the parent `.RC` file *prior* to reading it into Visual C++; then using Visual C++, add back the same `#include` statement as a Compile-Time Directive.
7070

71-
Visual C++ saves in an `.RC` file the three kinds of above Set Includes information (Symbol Header File, Read-Only Symbol Directives, and Compile-Time Directives) in `#include` directives *and* in `TEXTINCLUDE` resources. The `TEXTINCLUDE` resources, an implementation detail that you don't normally need to deal with, are explained in [How Visual C++ Manages Set Includes Information](#_mfcnotes_tn035_set_includes).
71+
Visual C++ saves in an `.RC` file the three kinds of above Set Includes information (Symbol Header File, Read-Only Symbol Directives, and Compile-Time Directives) in `#include` directives *and* in `TEXTINCLUDE` resources. The `TEXTINCLUDE` resources, an implementation detail that you don't normally need to deal with, are explained in [How Visual C++ manages set includes information](#_mfcnotes_tn035_set_includes).
7272

73-
## Analysis of AppWizard-Created `.RC` and `.H` Files
73+
## Analysis of AppWizard-created `.RC` and `.H` files
7474

7575
Examining the application code produced by AppWizard provides insight into how Visual C++ manages multiple resource files and header files. The code excerpts examined below are from a `MYAPP` application produced by AppWizard using the default options.
7676

@@ -110,7 +110,7 @@ If you use custom formatted resources, you can add them to `RES\MYAPP.RC2` and e
110110

111111
`AFXRES.H` defines standard symbols, such as `ID_FILE_NEW`, used by the framework and specifically used in `AFXRES.RC`. `AFXRES.H` also uses `#include` to include `WINRES.H`, which contains a subset of `WINDOWS.H` that's needed by Visual C++ generated `.RC` files and `AFXRES.RC`. The symbols defined in `AFXRES.H` are available as you edit the application resource file (`MYAPP.RC`). For example, `ID_FILE_NEW` is used for the `File` `New` menu item in the `MYAPP.RC` file's menu resource. You can't change or delete these framework-defined symbols.
112112

113-
## <a name="_mfcnotes_tn035_including"></a> Including Additional Header Files
113+
## <a name="_mfcnotes_tn035_including"></a> Including additional header files
114114

115115
The AppWizard-created application includes only two header files: `RESOURCE.H` and `AFXRES.H`. Only `RESOURCE.H` is application-specific. You may need to include additional read-only header files in the following cases:
116116

@@ -150,7 +150,7 @@ The new file relationship diagram now looks like this:
150150
AFXPRINT.RC
151151
```
152152

153-
## Sharing a Header File Between Two `.RC` Files
153+
## Sharing a header file between two `.RC` files
154154

155155
You may want to share a header file between two `.RC` files that are in different projects, or possibly the same project. To do so, apply the Read-Only Directives technique described above to both `.RC` files. In the case where the two `.RC` files are for different applications (different projects), the result is illustrated in the following diagram:
156156

@@ -168,7 +168,7 @@ RES\MYAPP1.RC2 AFXRES.RC RES\MYAPP2.RC2
168168

169169
The case where the second header file is shared by two `.RC` files in the same application (project) is discussed below.
170170

171-
## Using Multiple Resource Files in the Same Project
171+
## Using multiple resource files in the same project
172172

173173
Visual C++ and the Resource Compiler support multiple `.RC` files in the same project through `#include` directives that include one `.RC` file within another. Multiple nesting is allowed. There are various reasons to split your project's resources into multiple `.RC` files:
174174

@@ -209,7 +209,7 @@ The result is illustrated in the following diagram:
209209

210210
Using Compile-Time Directives, you can organize your Visual C++-editable and non-editable resources into multiple `.RC` files, where the main `MYAPP.RC` does nothing but `#include` the other `.RC` files. If you're using a Visual Studio C++ project `.MAK` file, then you should include the main `.RC` file in the project so that all the included resources are compiled with your application.
211211

212-
## Enforcement of Noneditable Visual C++ Files
212+
## Enforcement of non-editable Visual C++ files
213213

214214
The AppWizard-created `RES\MYAPP.RC2` file is an example of a file that contains resources that you don't want to accidentally read into Visual C++ and then write back out with loss of formatting information. To protect against this problem, place the following lines in the beginning of the `RES\MYAPP.RC2` file:
215215

@@ -221,7 +221,7 @@ The AppWizard-created `RES\MYAPP.RC2` file is an example of a file that contains
221221

222222
When Visual C++ compiles the `.RC` file, it defines both `APSTUDIO_INVOKED` and `RC_INVOKED`. If the AppWizard-created file structure is corrupted and Visual C++ reads the #error line above, it reports a fatal error and aborts the reading of the `.RC` file.
223223

224-
## Managing Symbols Shared by Multiple Visual C++-Edited `.RC` Files
224+
## Managing symbols shared by multiple Visual C++-edited `.RC` files
225225

226226
Two issues arise when you split up your resources into multiple `.RC` files that you want to edit separately in Visual C++:
227227

@@ -247,7 +247,7 @@ The `ID_TOOLS_SPELL` symbol is kept in the shared header file, `MYSHARED.H`. You
247247

248248
It's most convenient to anticipate a symbol you'll share before you attempt to use it to identify any resource. Add the symbol to the shared header file and, if you haven't already included the shared header file in the Read-Only Directives for the `.RC` file, do so before using the symbol. If you didn't anticipate sharing the symbol in this way, then you'll have to manually (using a text editor) move the #define statement for the symbol from, say, `MYMENUS.H` to `MYSHARED.H` before using it in `MYSTRS.RC`.
249249

250-
When you manage symbols in multiple `.RC` files, you also must help Visual C++ avoid assigning the same ID numeric values to distinct resources (symbols). For any given `.RC` file, Visual C++ incrementally assigns IDs in each of four ID domains. Between editing sessions, Visual C++ keeps track of the last ID it assigned in each of the domains in the symbol header file for the `.RC` file. Here's what the `APS_NEXT` values are for an empty (new) `.RC` file:
250+
When you manage symbols in multiple `.RC` files, you also must help Visual C++ avoid assigning the same ID numeric values to distinct resources (symbols). For any given `.RC` file, Visual C++ incrementally assigns IDs in each of four ID domains. Between editing sessions, Visual C++ keeps track of the last ID it assigned in each of the domains in the Symbol Header File for the `.RC` file. Here's what the `APS_NEXT` values are for an empty (new) `.RC` file:
251251

252252
```rc
253253
#define _APS_NEXT_RESOURCE_VALUE 101
@@ -279,7 +279,7 @@ To avoid this issue, you should reserve a separate numeric range for each of the
279279

280280
Of course, it's still possible that Visual C++ will assign so many IDs in the first `.RC` file that the numeric values start to overlap the ones reserved for the second `.RC` file. You should reserve sufficiently large ranges so that this collision doesn't happen.
281281

282-
## Managing Dependencies Between `.RC`, `.CPP`, and `.H` Files
282+
## Managing dependencies between `.RC`, `.CPP`, and `.H` files
283283

284284
When Visual C++ saves an `.RC` file, it also saves symbol changes to the corresponding `RESOURCE.H` file. Any of your `.CPP` files that refer to resources in the `.RC` file must use `#include` to include the `RESOURCE.H` file, usually from within your project's main header file. This inclusion leads to an undesirable side-effect because of the development environment's internal project management, which scans source files for header dependencies. Every time you add a new symbol in Visual C++, all the `.CPP` files that have `#include "RESOURCE.H"` directives would need to be recompiled.
285285

@@ -293,7 +293,7 @@ The development environment interprets this comment by ignoring the changes to `
293293

294294
Visual C++ always adds the `//{{NO_DEPENDENCIES}}` comment line to a `.RC` file when it saves the file. In some cases, circumventing of the build dependency on `RESOURCE.H` may lead to run-time errors undetected at link time. For example, if you use the Symbol Browser to change the numeric value assigned to a symbol for a resource, the resource won't be correctly found and loaded at application run-time if the `.CPP` file referring to the resource isn't recompiled. In such cases, you should explicitly recompile any `.CPP` files that you know are affected by the symbol changes in `RESOURCE.H` or select **Rebuild All**. If you have the need to frequently change symbol values for a certain group of resources, you'll probably find it more convenient and safer to break out these symbols into a separate read-only header file, as described in the above section [Including Additional Header Files](#_mfcnotes_tn035_including).
295295

296-
## <a name="_mfcnotes_tn035_set_includes"></a> How Visual C++ Manages Set Includes Information
296+
## <a name="_mfcnotes_tn035_set_includes"></a> How Visual C++ manages Set Includes information
297297

298298
As discussed above, the File menu Set Includes command lets you specify three types of information:
299299

@@ -315,7 +315,7 @@ The purpose of the `TEXTINCLUDE` resource is to safely store Set Include informa
315315
|2|Read-Only Symbol Directives|
316316
|3|Compile-Time Directives|
317317

318-
Each of the three types of Set Includes information is illustrated by the default `MYAPP.RC` and `RESOURCE.H` files created by AppWizard, as described below. The extra \0 and "" tokens between `BEGIN` and `END` blocks are required by the RC syntax to specify zero terminated strings and the double quote character respectively.
318+
Each of the three types of Set Includes information is illustrated by the default `MYAPP.RC` and `RESOURCE.H` files created by AppWizard, as described below. The extra `\0` and `""` tokens between `BEGIN` and `END` blocks are required by the RC syntax to specify zero terminated strings and the double quote character respectively.
319319

320320
### Symbol Header File
321321

0 commit comments

Comments
 (0)