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
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.
13
19
14
20
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.
15
21
16
22
> [!NOTE]
17
23
> 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).
18
24
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.
20
26
21
-
### To copy resources between files using the drag-and-drop method
27
+
### To copy resources
22
28
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*.
24
30
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:
26
32
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
28
34
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**.
31
36
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*.
33
38
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.
35
41
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
37
43
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**.
39
45
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**.
42
47
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.
45
50
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.
47
53
48
54
While copying in a resource, you can change its language property or condition property, or both.
49
55
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.
51
57
52
58
- 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.
53
59
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`:
55
61
56
62
```cpp
57
63
IDD_AboutBox (Finnish - XX33)
58
64
```
59
65
60
-
#### To copy an existing resource and change its language or condition
66
+
To copy an existing resource and change its language or condition
61
67
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:
65
69
66
70
- For the **Language** list box, select the language.
67
71
68
72
- In the **Condition** box, type the condition.
69
73
70
-
## Edit Resources
74
+
### To edit resources
71
75
72
76
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.
73
77
@@ -76,28 +80,24 @@ Managed resource files (.resx) are XML files. When you add a managed resource fi
76
80
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.
77
81
78
82
> [!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.
82
84
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
84
86
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**.
86
88
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.
88
90
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.
90
92
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.
95
95
96
-
1. In **Resource** view, right-click the resource you want to export.
96
+
### To export a resource for use outside of Visual C++
97
97
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.
99
99
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**.
0 commit comments