VC++ Express External Res Editor

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

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

Guy Lecky-Thompson, Self Portrait

Guy Lecky-Thompson - Guy W. Lecky-Thompson is the author of several technical and non-technical books, and writer at large. He has written for Dr. Dobbs ...

rss
Advertisement
Leave a comment

NOTE: Because you are not a Suite101 member, your comment will be moderated before it is viewable.
Submit
What is 4+1?

Comments

Aug 26, 2008 12:39 AM
Guest :
Hi there,
Nice article, though I cannot make it work with VC++ 2008 Express Edition. I can see the resources in the compiled exe in a hexeditor, but it does not display in Explorer.

Regards Kode Kyk
1
Advertisement
Advertisement