共用方式為


How to: Create a Resource

 

The latest version of this topic can be found at How to: Create a Resource.

NOTE]

Resource View is not supported in Express editions.

To create a new 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 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 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 resource from the Project menu

  1. 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.

Requirements

Win32

See Also

Resource Files
Resource Editors
Add Resource Dialog Box