Поделиться через


How to: Create a Resource

Note

Resource View is not available in Express editions.

To create a new Win32 resource in Resource View

  1. With focus on your .rc file in Resource View, click the Edit menu and choose Add Resource (or right-click the .rc file in Resource View and choose Add Resource from the shortcut menu).

    Note   If your project doesn't already contain an .rc file, please see Creating a New Resource Script File.

  2. In the Add Resource dialog box, choose the type of resource you'd like to add to your project.

To create a new Win32 resource in Solution Explorer

  1. In Solution Explorer, right-click the project folder and choose Add, then click Add Resource on the shortcut menu.

    If you do not already have an .rc file in your project, this step will create one. You can then repeat this step to add specific resource types to the new .rc file.

  2. In the Add Resource dialog box, choose the type of resource you'd like to add to your project.

To create a new Win32 resource in Class View

  1. In Class View, right-click your class and choose Add, then click Add Resource from the shortcut menu.

  2. In the Add Resource dialog box, choose the type of resource you'd like to add to your project.

To create a new Win32 resource from the Project menu

  • From the Project menu, choose Add Resource.

When you create a new resource, Visual C++ assigns a unique name to it, for example, IDD_Dialog1. You can customize this resource ID by editing the properties for the resource either in the associated resource editor or in the Properties Window.

You can create a resource as a new default resource (a resource that is not based on a template) or as a resource patterned after a template.

For information on adding resources to managed projects, please see Resources in Applications in the .NET Framework Developer's Guide. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resources strings to properties, see Walkthrough: Localizing Windows Forms and Walkthrough: Using Resources for Localization with ASP.NET.

Requirements

Win32

See Also

Reference

Resource Files (Visual Studio)

Resource Editors

Add Resource Dialog Box