Adding and Editing Resource Elements

Normally, you will be working with a project, and you will want to create your resources as a part of the project rather than as individual resource files. For this purpose, instead of opening a new file, select Insert from the main menu, select Resource, and then choose the type of resource to create from the Insert Resource dialog box (by double-clicking the resource, or highlighting it and clicking OK), as shown in Figure 7.4.

Figure 7.4: Adding a resource to a project

After you select the resource type, a new resource element is added to the resource list (on the left side of your screen) using a default type name, such as IDC_CURSOR1. At the same time, the appropriate editor is called to create the new resource element.

To create a custom resource element, select the Custom button from the Insert Resource dialog box, and then enter a name for the custom resource type. You must create custom resources independently, by whatever means are appropriate. The options here only permit you to include a custom resource and custom resource type within a project. You must handle all other provisions yourself, and they must conform to a response code within the application or an associated DLL.

You can change default element type names at any time by right-clicking the appropriate element in the resource list (on the left side of your screen) to call the pop-up menu. From the menu, select Properties to display the Properties dialog box, shown in Figure 7.5. Then simply enter a new resource name. A corresponding entry will be made in the Resource.H header automatically. This provides a convenient way to replace the default labels supplied when resource elements are generated with new mnemonic resource names.

Figure 7.5: Entering a new resource name in the Properties dialog box

You can edit an existing resource element simply by double-clicking it (or highlighting it and pressing Enter) in the project’s resource list. Doing this brings up the appropriate editor and loads the resource element.

© 1998 SYBEX Inc. All rights reserved.