Suite101

VC++ Express External Res Editor

Attach External Tool to Visual C++ Express for Editing Resources

© Guy Lecky-Thompson

Visual C++ Express Edition has no visual resource editor, so we decided to show everyone how to add one in a few simple steps.

Introduction

One of the issues that one encounters with the Visual C++ Express Edition, part of the freely available Visual Studio Express Editions from Microsoft, is that there are certain tools missing that were greatly appreciated in the non-Express versions. One of those is the resource editor.

Microsoft Windows Resource Files are compiled binaries that are added to a project after the link process to provide the resources that an application:

  • Icons;
  • Menus;
  • Dialog Boxes;
  • etc...

In order to provide a human-editable interface to this, the Resource Script (files ending in .RC) was invented. In essence, the RC file is interpreted into a binary stream (.RES file) which is then added to the application, after it has been compiled and linked. To create Resource Statements, which are plain text, there are two options : edit the file by hand (tedious) and in a visual editor (easy).

The tool that turns an .RC file into a .RES file is called the Resource Compiler, and all Win32 development environments come with one. The visual editor for the .RC file is not usually shipped with a compiler/linker/build tool, relying on outside packages. The two main compiler environments - Microsoft Visual Studio and, Borland Builder - both have them built into the premium edition, leaving the rest of us to try and find another solution.

Luckily, there are a few of those, starting with the XN Resource Editor, which we shall assume is bing used in the remainder of this article.

Resources You Will Need

Before continuing, there are a few bits and pieces that you will need:

  • Microsoft Visual Studio Express, C++ Edition
  • The XN Resource Editor
  • The Platform Development Kit (PSDK) from Microsoft

There are links to these at the end of the article. Help getting and installing them is available here. Be sure to follow Microsoft's instructions for setting up the SDK for compiling native Win32 applications, as specified here.

BR /

Creating the Win32 Project

Assuming that everything has been installed correctly, start up Visual Studio Express Edition and select File->New->Project.

In the dialog box, choose 'Win32 Console Application', choose a project name, and then click 'Next'. In the next screen make sure that a Windows Application is being built.

Click 'Finish' to create the project.

Removing the Standard RC File

Firstly, build and run the project, by pressing F5. This will create a working copy of the .RES file in the project's Debug build folder. Copy the .RES file to a known location, separate from the Debug and Release folders.

We are going to stick with debug builds for now, but the technique works equally well with other build types too.

In the project tree, there is a folder entry 'Resource Files', with several child items. Exclude the entry ending .rc from the project by right-clicking the item, and selecting 'Exclude from Project' in the popup menu.

At this point, the application has no resources associated with it.

Adding the RES File and XN Resource Editor

The final step is to right-click the 'Resource Folder' icon, and select 'Add', then 'Existing item' from the popup menus that follow.

Select the '.RES' file type in the browse file dialog box, and locate the copy of the .RES file that was created in the preceding stage.

Now, the project has a binary resource file associated with it. To edit that with the XN Resource Editor (for example) all we need to do is right click the .RES file and select 'Open With...'. In the resulting dialog box, click 'Add'. In the 'Add Program' dialog box enter the path (or browse to it) for the XN Resource Editor (probably in the 'Program Files' folder'), and a friendly name for the application.

Check that it works, by selecting the XN Resource Editor from the list box in the dialog box. If it does, the next time a .RES file is opened in this way, just click the 'Set as Default' button. That way, double clicking it will start up the XN Resource Editor by default.

This might seem long winded, but it is well worth the effort.

Links


The copyright of the article VC++ Express External Res Editor in Windows Programming is owned by Guy Lecky-Thompson. Permission to republish VC++ Express External Res Editor in print or online must be granted by the author in writing.





Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo