Skip to content

Commit 0262fe2

Browse files
authored
Merge pull request #1782 from msebolt/resource-file-revision-pr1
resource file revision pr1
2 parents ce8efb2 + f6f995b commit 0262fe2

5 files changed

+170
-219
lines changed

docs/windows/how-to-copy-resources.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,71 @@ ms.assetid: 65f523e8-017f-4fc6-82d1-083c56d9131f
77
---
88
# How to: Manage Resources (C++)
99

10-
## Copy Resources
10+
You can manage resources for your project by:
1111

12-
You can copy resources from one file to another without changing them or you can change the language or condition of a resource while copying it.
12+
- Copying and editing resources.
13+
14+
- Importing and exporting resources.
15+
16+
## Copy and Edit Resources
17+
18+
You can copy resources from one file to another without changing them, or changing the language or condition of a resource while copying it.
1319

1420
You can easily copy resources from an existing resource or executable file to your current resource file. To copy resources, you open both files containing resources at the same time and drag items from one file to another or copy and paste between the two files. This method works for resource script (.rc) files and resource template (.rct) files, and as executable (.exe) files.
1521

1622
> [!NOTE]
1723
> Visual C++ includes sample resource files that you can use in your own application. For more information, see [CLIPART: Common Resources](https://github.com/Microsoft/VCSamples).
1824
19-
You can use the drag-and-drop method between .rc files that are open [outside of the project](../windows/how-to-open-a-resource-script-file-outside-of-a-project-standalone.md).
25+
You can use the drag-and-drop method between .rc files that are open outside of the project.
2026

21-
### To copy resources between files using the drag-and-drop method
27+
### To copy resources
2228

23-
1. Open both resource files stand-alone (for more information, see [view resources in an .rc file outside of a project](../windows/how-to-open-a-resource-script-file-outside-of-a-project-standalone.md)). For example, open *Source1.rc* and *Source2.rc*.
29+
1. Open both resource files stand-alone (see how to [to open a resource script file](/how-to-create-a-resource-script-file#use-resource-script-files)). For example, open *Source1.rc* and *Source2.rc*.
2430

25-
1. Inside the first .rc file, select the resource you wish to copy. For example, in *Source1.rc*, select **IDD_DIALOG1**.
31+
1. Inside the first .rc file, either:
2632

27-
1. Hold down the **Ctrl** key and drag the resource to the second .rc file. For example, drag **IDD_DIALOG1** from *Source1.rc* to *Source2.rc*.
33+
- Use the drag-and-drop method
2834

29-
> [!NOTE]
30-
> Dragging the resource without holding down the **Ctrl** key moves the resource rather than copying it.
35+
1. Select the resource you wish to copy. For example, in *Source1.rc*, select **IDD_DIALOG1**.
3136

32-
### To copy resources using copy and paste
37+
1. Hold down the **Ctrl** key and drag the resource to the second .rc file. For example, drag **IDD_DIALOG1** from *Source1.rc* to *Source2.rc*.
3338

34-
1. Open both resource files stand-alone (for more information, see [view resources in an .rc file outside of a project](../windows/how-to-open-a-resource-script-file-outside-of-a-project-standalone.md)). For example, *Source1.rc* and *Source2.rc*.
39+
> [!TIP]
40+
> Dragging the resource without holding down the **Ctrl** key moves the resource rather than copying it.
3541
36-
1. In the source file from which you wish to copy a resource (for example, *Source1.rc*), right-click a resource and choose **Copy** from the shortcut menu.
42+
- Use the copy and paste method
3743

38-
1. Right-click the resource file into which you'd like to paste the resource (for example, *Source2.rc*). Choose **Paste** from the shortcut menu.
44+
1. Right-click the resource you with to copy (for example, *Source1.rc*) and choose **Copy**.
3945

40-
> [!NOTE]
41-
> You cannot drag and drop, copy, cut, or paste between resource files in the project (**Resource View**) and stand-alone .rc files (those open in document windows). You could do this in previous versions of the product.
46+
1. Right-click the resource file into which you'd like to paste the resource (for example, *Source2.rc*) and choose **Paste**.
4247

43-
> [!NOTE]
44-
> To avoid conflicts with symbol names or values in the existing file, Visual C++ may change the transferred resource's symbol value or symbol name and value when you copy it to the new file.
48+
> [!NOTE]
49+
> You can't drag and drop, copy, cut, or paste between resource files in the project (**Resource View**) and stand-alone .rc files (those open in document windows). You could do this in previous versions of the product.
4550
46-
### Change the language or condition of a resource while copying
51+
> [!NOTE]
52+
> To avoid conflicts with symbol names or values in the existing file, Visual C++ may change the transferred resource's symbol value or symbol name and value when you copy it to the new file.
4753
4854
While copying in a resource, you can change its language property or condition property, or both.
4955

50-
- The language of the resource identifies just that, the language for the resource. The language is used by [FindResource](/windows/desktop/api/winbase/nf-winbase-findresourcea) to help identify the resource for which you're looking. (However, resources can have differences for each language that aren't related to text, for example, accelerators that might only work on a Japanese keyboard or a bitmap that would only be appropriate for Chinese localized builds.)
56+
- The language of a resource specifies the language used by [FindResource](/windows/desktop/api/winbase/nf-winbase-findresourcea) to help identify the resource for which you're looking. Resources can have differences for each language that aren't related to text, for example, accelerators that might only work on a Japanese keyboard or a bitmap that would only be appropriate for Chinese localized builds.
5157

5258
- The condition of a resource is a defined symbol that identifies a condition under which this particular copy of the resource is to be used.
5359

54-
The language and condition of a resource are shown in parentheses after the name of the resource in the **Workspace** window. In this example, the resource named `IDD_AboutBox` is using `Finnish` as its language and its condition is `XX33`.
60+
The language and condition of a resource are shown in parentheses after the name of the resource in the **Workspace** window. Here the resource named `IDD_AboutBox` is using `Finnish` as its language and its condition is `XX33`:
5561

5662
```cpp
5763
IDD_AboutBox (Finnish - XX33)
5864
```
5965
60-
#### To copy an existing resource and change its language or condition
66+
To copy an existing resource and change its language or condition
6167
62-
1. In the .rc file or in the [Resource View](../windows/resource-view-window.md) window, right-click the resource you want to copy.
63-
64-
1. Choose **Insert Copy** from the shortcut menu and set the following:
68+
1. In the .rc file or in the [Resource View](../windows/resource-view-window.md) window, right-click the resource you want to copy and choose **Insert Copy**. Then set the following:
6569
6670
- For the **Language** list box, select the language.
6771
6872
- In the **Condition** box, type the condition.
6973
70-
## Edit Resources
74+
### To edit resources
7175
7276
Managed resource files (.resx) are XML files. When you add a managed resource file to your project from the **Add New Item** dialog box, the **Managed Resources Editor** opens by default.
7377
@@ -76,28 +80,24 @@ Managed resource files (.resx) are XML files. When you add a managed resource fi
7680
You can import graphical resources (bitmaps, icons, cursors, and toolbars), HTML files, and custom resources for use in Visual C++. You can export the same types of files from a Visual C++ project to separate files that can be used outside the development environment.
7781
7882
> [!NOTE]
79-
> Resource types such as accelerators, dialog boxes, and string tables cannot be imported or exported because they are not stand-alone file types.
80-
81-
### To import an individual resource into your current resource file
83+
> Resource types such as accelerators, dialog boxes, and string tables can't be imported or exported because they're not stand-alone file types.
8284
83-
1. In [Resource View](../windows/resource-view-window.md), right-click the node for the resource script (*.rc) file to which you want to add a resource.
85+
### To import a resource into the resource script file
8486
85-
1. Select **Import** on the shortcut menu.
87+
1. In [Resource View](../windows/resource-view-window.md) right-click the node of the resource script (.rc) file to which you want to add a resource and select **Import**.
8688
87-
1. Locate and select the file name of the bitmap (.bmp), icon (.ico), cursor (.cur), Html file (.htm), or other file that you want to import.
89+
1. Locate and choose the file name of the bitmap (.bmp), icon (.ico), cursor (.cur), html file (.htm), or other file to import.
8890
89-
1. Choose **OK** to add the resource to the selected file in **Resource** view.
91+
1. Select **OK** to add the resource to the resource script file.
9092
91-
> [!NOTE]
92-
> The import process works the same way no matter which particular resource type you have selected. The imported resource is automatically added to the correct node for that resource type.
93-
94-
### To export a bitmap, icon, or cursor as a separate file (for use outside of Visual C++)
93+
> [!NOTE]
94+
> The import process works the same no matter which resource type you have selected. The imported resource is automatically added to the correct node of that resource type.
9595
96-
1. In **Resource** view, right-click the resource you want to export.
96+
### To export a resource for use outside of Visual C++
9797
98-
1. Select **Export** on the shortcut menu and accept the current file name or type a new one.
98+
1. In [Resource View](../windows/resource-view-window.md), right-click the resource you want to export and select **Export**. You can accept the current file name or type a new one.
9999
100-
1. Navigate to the folder where you want to save the file and choose **Export**.
100+
1. Navigate to the folder where you want to save the file and select **Export**.
101101
102102
## Requirements
103103
@@ -106,5 +106,5 @@ Win32
106106
## See Also
107107
108108
[Resource Files](../windows/resource-files-visual-studio.md)<br/>
109-
[Create Resources](../windows/how-to-create-a-resource-script-file.md)<br/>
110-
[Include Resources at Compile Time](../windows/how-to-include-resources-at-compile-time.md)<br/>
109+
[How to: Create Resources](../windows/how-to-create-a-resource-script-file.md)<br/>
110+
[How to: Include Resources at Compile Time](../windows/how-to-include-resources-at-compile-time.md)<br/>

0 commit comments

Comments
 (0)