Skip to content

Commit 7a9b69a

Browse files
authored
Merge pull request #1724 from msebolt/resource-file-consolidation-pr35
resource file consolidation pr35
2 parents e9f55d6 + 87c2ff8 commit 7a9b69a

5 files changed

Lines changed: 50 additions & 84 deletions

‎.openpublishing.redirection.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7770,6 +7770,16 @@
77707770
"redirect_url": "/cpp/windows/how-to-create-a-resource",
77717771
"redirect_document_id": false
77727772
},
7773+
{
7774+
"source_path": "docs/windows/resource-includes-dialog-box.md",
7775+
"redirect_url": "/cpp/windows/how-to-include-resources-at-compile-time",
7776+
"redirect_document_id": false
7777+
},
7778+
{
7779+
"source_path": "docs/windows/how-to-specify-include-directories-for-resources.md",
7780+
"redirect_url": "/cpp/windows/how-to-include-resources-at-compile-time",
7781+
"redirect_document_id": false
7782+
},
77737783
{
77747784
"source_path": "docs/windows/activationfactory-activationfactory-constructor.md",
77757785
"redirect_url": "/cpp/windows/activationfactory-class#activationfactory",

‎docs/windows/TOC.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#### [How to: Open a Resource Script File in Text Format](how-to-open-a-resource-script-file-in-text-format.md)
1717
#### [How to: Add MFC Support to Resource Script Files](how-to-add-mfc-support-to-resource-script-files.md)
1818
#### [How to: Include Resources at Compile Time](how-to-include-resources-at-compile-time.md)
19-
##### [Resource Includes Dialog Box](resource-includes-dialog-box.md)
20-
##### [How to: Specify Include Directories for Resources](how-to-specify-include-directories-for-resources.md)
2119
#### [How to: Copy Resources](how-to-copy-resources.md)
2220
##### [How to: Change the Language or Condition of a Resource While Copying](how-to-change-the-language-or-condition-of-a-resource-while-copying.md)
2321
#### [How to: Search for Symbols in Resources](how-to-search-for-symbols-in-resources.md)
Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,68 @@
11
---
22
title: "How to: Include Resources at Compile Time (C++)"
33
ms.date: "11/04/2016"
4-
f1_keywords: ["vs.resvw.resource.including", "vc.resvw.resource.including"]
5-
helpviewer_keywords: ["comments [C++], compiled files", "resources [C++], including at compile time", "projects [C++], including resources", "#include directive", "include directive (#include)"]
4+
f1_keywords: ["vs.resvw.resource.including", "vc.resvw.resource.including", "vc.editors.resourceincludes"]
5+
helpviewer_keywords: ["comments [C++], compiled files", "resources [C++], including at compile time", "projects [C++], including resources", "#include directive", "include directive (#include)", "Resource Includes dialog box [C++]", "rc files [C++], changing storage", "symbol header files [C++], changing", ".rc files [C++], changing storage", "symbol header files [C++], read-only", "symbols [C++], symbol header files", "directories [C++], specifying include paths for resources", "include files [C++], specifying for resources", "resources [C++], including in projects"]
66
ms.assetid: 357e93c2-0a29-42f9-806f-882f688b8924
77
---
88
# How to: Include Resources at Compile Time
99

10-
Normally it is easy and convenient to work with the default arrangement of all resources in one resource script (.rc) file. However, you can add resources in other files to your current project at compile time by listing them in the **Compile-time directives** box in the [Resource Includes dialog box](../windows/resource-includes-dialog-box.md).
10+
Normally it's easy and convenient to work with the default arrangement of all resources in one resource script (.rc) file. However, you can add resources in other files to your current project at compile time by listing them in the **Compile-time directives** box in the **Resource Includes** dialog box.
1111

1212
There are several reasons to place resources in a file other than the main .rc file:
1313

14-
- To add comments to resource statements that will not get deleted when you save the .rc file.
14+
- To add comments to resource statements that won't get deleted when you save the .rc file.
1515

16-
The resource editors do not directly read .rc or `resource.h` files. The resource compiler compiles them into .aps files, which are consumed by the resource editors. This file is a compile step and only stores symbolic data. As with a normal compile process, information that is not symbolic (for example, comments) is discarded during the compile process. Whenever the .aps file gets out of synch with the .rc file, the .rc file is regenerated (for example, when you Save, the resource editor overwrites the .rc file and the `resource.h` file). Any changes to the resources themselves will remain incorporated in the .rc file, but comments will always be lost once the .rc file is overwritten.
16+
The resource editors don't directly read .rc or `resource.h` files. The resource compiler compiles them into .aps files, which are consumed by the resource editors. This file is a compile step and only stores symbolic data. As with a normal compile process, information that isn't symbolic (for example, comments) is discarded during the compile process. Whenever the .aps file gets out of synch with the .rc file, the .rc file is regenerated (for example, when you Save, the resource editor overwrites the .rc file and the `resource.h` file). Any changes to the resources themselves will remain incorporated in the .rc file, but comments will always be lost once the .rc file is overwritten.
1717

18-
- To include resources that have already been developed and tested and do not need further modification. (Any files that are included but don't have an .rc extension will not be editable by the resource editors.)
18+
- To include resources that have already been developed and tested and don't need further modification. (Any files that are included but don't have an .rc extension won't be editable by the resource editors.)
1919

20-
- To include resources that are being used by several different projects, or that are part of a source code version-control system, and thus must exist in a central location where modifications will affect all projects.
20+
- To include resources that are being used by several different projects, or that are part of a source code version-control system, and so must exist in a central location where modifications will affect all projects.
2121

2222
- To include resources (such as RCDATA resources) that are in a custom format. RCDATA resources may have special requirements. For example, you cannot use an expression as a value for the nameID field. See the Windows SDK documentation for more information.
2323

24-
If you have sections in your existing .rc files that meet any of these conditions, you should place the sections in one or more separate .rc files and include them in your project using the [Resource Includes dialog box](../windows/resource-includes-dialog-box.md). The *Projectname*.rc2 file created in the \res subdirectory of a new project is used for this purpose.
24+
If you have sections in your existing .rc files that meet any of these conditions, you should place the sections in one or more separate .rc files and include them in your project using the **Resource Includes** dialog box. The *Projectname*.rc2 file created in the \res subdirectory of a new project is used for this purpose.
2525

26-
### To include resources in your project at compile time
26+
You can use the **Resource Includes** dialog box in a C++ project to modify the environment's normal working arrangement of storing all resources in the project .rc file and all [symbols](../windows/symbols-resource-identifiers.md) in Resource.h.
2727

28-
1. Place the resources in a resource script file with a unique file name. Do not use *projectname*.rc, because this is the file name used for the main resource script file.
28+
To open the **Resource Includes** dialog box, right-click an .rc file in [Resource View](../windows/resource-view-window.md), then choose **Resource Includes** from the shortcut menu. This dialog box has the following properties:
2929

30-
2. Right-click the .rc file (in [Resource View](../windows/resource-view-window.md)) and choose **Resource Includes** from the shortcut menu.
30+
|Property|Description|
31+
|---|---|
32+
|**Symbol header file**|Allows you to change the name of the header file where the symbol definitions for your resource file are stored. For more information, see [Changing the Names of Symbol Header Files](../windows/changing-the-names-of-symbol-header-files.md).|
33+
|**Read-only symbol directives**|Enables you to include header files that contain symbols that shouldn't be modified during an editing session. For example, you can include a symbol file that is shared among several projects. You can also include MFC .h files. For more information, see [Including Shared (Read-Only) or Calculated Symbols](../windows/including-shared-read-only-or-calculated-symbols.md).|
34+
|**Compile-time directives**|Allows you to include resource files that are created and edited separately from the resources in your main resource file, contain compile-time directives (such as those directives that conditionally include resources), or contain resources in a custom format. You can also use the **Compile-time directives box** to include standard MFC resource files. For more information, see [Including Resources at Compile Time](../windows/how-to-include-resources-at-compile-time.md).|
3135

32-
3. In the **Compile-time directives** box, add the [#include](../preprocessor/hash-include-directive-c-cpp.md) compiler directive to include the new resource file in the main resource file in the development environment.
36+
> [!NOTE]
37+
> Entries in these text boxes appear in the .rc file marked by `TEXTINCLUDE 1`, `TEXTINCLUDE 2`, and `TEXTINCLUDE 3` respectively. For more information, see [TN035: Using Multiple Resource Files and Header Files with Visual C++](../mfc/tn035-using-multiple-resource-files-and-header-files-with-visual-cpp.md).
3338
34-
The resources in files included in this way are made a part of your executable file at compile time. They are not directly available for editing or modification when you are working on your project's main .rc file. You need to open included .rc files separately. Any files that are included but don't have an .rc extension will not be editable by the resource editors.
39+
Once you have made changes to your resource file using the **Resource Includes** dialog box, you need to close the .rc file and then reopen it for the changes to take effect. For more information, see [Including Resources at Compile Time](../windows/how-to-include-resources-at-compile-time.md).
40+
41+
For information on adding resources to managed projects, see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the .NET Framework Developer's Guide.
42+
43+
## To include resources in your project at compile time
44+
45+
1. Place the resources in a resource script file with a unique file name. Don't use *projectname*.rc, because this name is the file name used for the main resource script file.
46+
47+
1. Right-click the .rc file (in [Resource View](../windows/resource-view-window.md)) and choose **Resource Includes** from the shortcut menu.
48+
49+
1. In the **Compile-time directives** box, add the [#include](../preprocessor/hash-include-directive-c-cpp.md) compiler directive to include the new resource file in the main resource file in the development environment.
50+
51+
The resources in files included in this way are made a part of your executable file at compile time. They aren't directly available for editing or modification when you're working on your project's main .rc file. Open included .rc files separately. Any files that are included but don't have an .rc extension won't be editable by the resource editors.
52+
53+
## To specify include directories for a specific resource (.rc file) (C++)
54+
55+
1. Right-click the .rc file in Solution Explorer and select **Properties** from the shortcut menu.
56+
57+
1. In the **Property Pages** dialog box, select the **Resources** node in the left pane, then specify the additional include directories in the **Additional include directories** property.
3558

3659
## Requirements
3760

3861
Win32
3962

40-
## See Also
63+
## See also
4164

4265
[Resource Files](../windows/resource-files-visual-studio.md)<br/>
43-
[Resource Editors](../windows/resource-editors.md)
66+
[Resource Editors](../windows/resource-editors.md)<br/>
67+
[TN035: Using Multiple Resource Files and Header Files with Visual C++](../mfc/tn035-using-multiple-resource-files-and-header-files-with-visual-cpp.md)<br/>
68+
[Symbols: Resource Identifiers](../windows/symbols-resource-identifiers.md)<br/>

‎docs/windows/how-to-specify-include-directories-for-resources.md‎

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

‎docs/windows/resource-includes-dialog-box.md‎

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

0 commit comments

Comments
 (0)