Resource files (C++)
Note
Since projects in .NET programming languages do not use resource script files, you must open your resources from Solution Explorer. Use the Image editor and the Binary editor to work with resource files in managed projects.
Any managed resources you want to edit must be linked resources. The Visual Studio resource editors do not support editing embedded resources.
The term resource file can refer to any of several file types, such as:
The resource script (
.rc
) file of a program.A resource template (
.rct
) file.An individual resource existing as a stand-alone file. This type includes a bitmap, icon, or cursor file that's referred to from an
.rc
file.A header file generated by the development environment. This type includes
Resource.h
, that's referred to from an.rc
file.
Other file types such as .exe
, .dll
, and .res
files may also contain resources you can access, though the first two aren't normally considered resource files.
You can work with resource files and resources from within your project. You can also work with resources and resource files that aren't part of the current project, or that were created outside the development environment of Visual Studio. For example, you can:
Work with nested and conditionally included resource files.
Update existing resources or convert them to Visual C++.
Import or export graphic resources to or from your current resource file.
Include shared or read-only identifiers (symbols) that can't be modified by the development environment.
Include resources in your executable (
.exe
or.dll
) file that don't need editing (or shouldn't be edited), such as shared resources between several projects.Include resource types not supported by the development environment.
For more information on resources, see how to Create resources, Manage resources, and Include resources at compile time.
Editable resources
The following types of files can be opened to edit the resources they contain:
File name | Description |
---|---|
.rc |
Resource script files |
.rct |
Resource template files |
.res |
Resource files |
.resx |
Managed resource files |
.exe |
Executable files |
.dll |
Dynamic-link library files |
.bmp , .ico , .dib , .cur |
Bitmap, icon, toolbar, and cursor files |
The Visual Studio environment works with and affects the following files when editing resources:
File name | Description |
---|---|
Resource.h |
Header file generated by the development environment that contains symbol definitions. Include this file in source control. |
Filename.aps |
Binary version of the current resource script file used for quick loading. Resource editors don't directly read .rc or resource.h files. The resource compiler compiles them into .aps files that are consumed by the resource editors. This file is a compile step and only stores symbolic data.As with a normal compile process, information that isn't symbolic, such as comments, is discarded during the compile process. Whenever the .aps file is out of synch with the .rc file, the .rc file is regenerated. For example, when you Save, the resource editor overwrites the .rc file and the resource.h file. Any changes to the resources themselves remain incorporated in the .rc file, but comments are always lost once the .rc file is overwritten. For information on how to preserve comments, see Include resources at compile time.Typically, you shouldn't include the .aps file in source control. |
.rc |
Resource script file that contains script for the resources in your current project. This file is overwritten by the .aps file whenever you save.Include this file in source control. |
Manifest resources
In C++ desktop projects, manifest resources are XML files that describe the dependencies an application uses. For example, in Visual Studio, this MFC wizard-generated manifest file defines which version of the Windows common control DLLs the application should use:
<description>Your app description here</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
For a Windows XP or Windows Vista application, the manifest resource should specify the most current version of the Windows common controls for the application to use. The example above uses version 6.0.0.0
, which supports the Syslink
control.
Note
You can only have one manifest resource per module.
To view the version and type information contained in a manifest resource, open the file in an XML viewer or the Visual Studio text editor. If you open a manifest resource from Resource View, the resource will open in binary format.
To open a manifest resource
Open your project in Visual Studio and navigate to Solution Explorer.
Expand the Resource Files folder, then:
To open in the text editor, double-click the
.manifest
file.To open in another editor, right-click the
.manifest
file and select Open With. Specify the editor to use and select Open.
Requirements
Win32
See also
Working with resource files
Resource identifiers (Symbols)
Resource editors