|
1 | 1 | --- |
2 | 2 | title: "How to: Copy Resources (C++)" |
3 | 3 | ms.date: "11/04/2016" |
4 | | -f1_keywords: ["vc.resvw.resource.copying", "vs.resvw.resource.copying"] |
5 | | -helpviewer_keywords: ["resources [C++], moving between files", "resources [C++], copying", "resource files [C++], copying or moving resources between", "resource files [C++], tiling", ".rc files [C++], copying resources between", "rc files [C++], copying resources between"] |
| 4 | +f1_keywords: ["vc.resvw.resource.copying", "vs.resvw.resource.copying", "vc.resvw.resource.changing"] |
| 5 | +helpviewer_keywords: ["resources [C++], moving between files", "resources [C++], copying", "resource files [C++], copying or moving resources between", "resource files [C++], tiling", ".rc files [C++], copying resources between", "rc files [C++], copying resources between", "Language property [C++]"] |
6 | 6 | ms.assetid: 65f523e8-017f-4fc6-82d1-083c56d9131f |
7 | 7 | --- |
8 | 8 | # How to: Copy Resources (C++) |
9 | 9 |
|
10 | | -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](../windows/how-to-change-the-language-or-condition-of-a-resource-while-copying.md). |
| 10 | +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. |
11 | 11 |
|
12 | | -You can easily copy resources from an existing resource or executable file to your current resource file. To do this, 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, as well as executable (.exe) files. |
| 12 | +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. |
13 | 13 |
|
14 | 14 | > [!NOTE] |
15 | 15 | > 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). |
16 | 16 |
|
17 | 17 | 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). |
18 | 18 |
|
19 | | -### To copy resources between files using the drag-and-drop method |
| 19 | +## To copy resources between files using the drag-and-drop method |
20 | 20 |
|
21 | 21 | 1. Open both resource files stand-alone (for more information, see [Viewing 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. |
22 | 22 |
|
23 | | -2. Inside the first .rc file, click the resource you wish to copy. For example, in `Source1.rc`, click **IDD_DIALOG1**. |
| 23 | +1. Inside the first .rc file, select the resource you wish to copy. For example, in `Source1.rc`, select **IDD_DIALOG1**. |
24 | 24 |
|
25 | | -3. 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`. |
| 25 | +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`. |
26 | 26 |
|
27 | 27 | > [!NOTE] |
28 | 28 | > Dragging the resource without holding down the **Ctrl** key moves the resource rather than copying it. |
29 | 29 |
|
30 | | -### To copy resources using copy and paste |
| 30 | +## To copy resources using copy and paste |
31 | 31 |
|
32 | 32 | 1. Open both resource files stand-alone (for more information, see [Viewing 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. |
33 | 33 |
|
34 | | -2. 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. |
| 34 | +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. |
35 | 35 |
|
36 | | -3. Right-click the resource file into which you'd like to paste the resource (for example, `Source2.rc`). Choose **Paste** from the shortcut menu. |
| 36 | +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. |
37 | 37 |
|
38 | 38 | > [!NOTE] |
39 | 39 | > 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. |
40 | 40 |
|
41 | 41 | > [!NOTE] |
42 | 42 | > 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. |
43 | 43 |
|
44 | | -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*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index). |
| 44 | +## To change the language or condition of a resource while copying (C++) |
| 45 | + |
| 46 | +While copying in a resource, you can change its language property or condition property, or both. |
| 47 | + |
| 48 | +- 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.) |
| 49 | + |
| 50 | +- 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. |
| 51 | + |
| 52 | +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. |
| 53 | + |
| 54 | +```cpp |
| 55 | +IDD_AboutBox (Finnish - XX33) |
| 56 | +``` |
| 57 | +
|
| 58 | +### To copy an existing resource and change its language or condition |
| 59 | +
|
| 60 | +1. In the .rc file or in the [Resource View](../windows/resource-view-window.md) window, right-click the resource you want to copy. |
| 61 | +
|
| 62 | +1. Choose **Insert Copy** from the shortcut menu. |
| 63 | +
|
| 64 | +1. In the **Insert Resource Copy** dialog box: |
| 65 | +
|
| 66 | + - For the **Language** list box, select the language. |
| 67 | +
|
| 68 | + - In the **Condition** box, type the condition. |
| 69 | +
|
| 70 | +For information on adding resources to managed projects, see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index). |
45 | 71 |
|
46 | 72 | ## Requirements |
47 | 73 |
|
48 | 74 | Win32 |
49 | 75 |
|
50 | | -## See Also |
| 76 | +## See also |
51 | 77 |
|
52 | | -[How to: Open a Resource Script File Outside of a Project (Standalone)](../windows/how-to-open-a-resource-script-file-outside-of-a-project-standalone.md)<br/> |
53 | 78 | [Resource Files](../windows/resource-files-visual-studio.md)<br/> |
54 | | -[Resource Editors](../windows/resource-editors.md) |
| 79 | +[Resource Editors](../windows/resource-editors.md)<br/> |
| 80 | +[How to: Open a Resource Script File Outside of a Project (Standalone)](../windows/how-to-open-a-resource-script-file-outside-of-a-project-standalone.md)<br/> |
0 commit comments