objmedia.demon.co.uk

Strings to Resources

This page describes how to use the Strings to Resources converter. The source code and executable can be found on the software page.

This program modifies the source files to you programs. You are recommended to backup your source code prior to using this program, or to use the confirm option and the backup option.

Controls

Directory. Specify the directory to be scanned for files to convert. Either type the directory name or use the Windows file dialog.

Resource file. Specify the resource file to be used for this conversion (typically projectName.rc). Either type the directory name or use the Windows file dialog.

Header file. Specify the header file to be used for this conversion (typically resource.h). Either type the directory name or use the Windows file dialog.

Examine. Examine the list of changes that have been made.

Scan. Scan the files to find out how many potential changes there are.

Convert. Scan the files and convert the files according to the controls.

Close. Close the program.

When the files are being converted, if the confirm option is enabled a confirmation dialog is displayed. The dialog displays some source code before and after the line to convert to provide context. The line to convert has a ==> symbol at the start of the line.

Important Notes

This program replaces _T("string") with a reference to a CString. The CString will be declared earlier in the function where the string was originally declared. The CString will be given an autogenerated name based partly on the text of the string and partly on the resource ID assigned to the string when the string was added to the resource file and the header file.

Some strings are defined outside of functions and thus the replacement CString and its associated LoadString(IDS_???) call are defined outside of functions. Such code will not compile. You may need to edit some or all of the converted files to move code that references such CStrings into functions, or create initialisation functions that should be called when the program is started or when a dialog is created, etc.

Occasionally the parser will also place CStrings just before a function definition rather than in the function. This doesn't happen often, but will need to be edited to fix this.

If CStrings are assigned in a loop, or the function the CStrings are loaded in (using LoadString()) is in a loop you will suffer performance penalties due to LoadString(). You may need to identify such functions and restructure your code appropriately. For general user interface work however such changes are unlikely to be necessary.

As always with programs that modify source code, backup your work before proceeding. Object Media will not be held responsible for any loss incurred by using this program. You use this program at your own risk.

About Us | Site Map | Legal | Contact Us | ©1994-2008: Object Media Ltd : all rights reserved: registered in England No. 297036