Overview
Microsoft Visual Studio 6.0 offers only a framework to build all resources into one executable file. This can be disturbing if you want to localize your application into completely separated files. Fortunately VC++'s wide environment allows you to achieve this with a couple of steps...
Steps:
- Rename your default Demo.rc file to Demo_EN.rc or other names depending on the language version.
- Create a new default Demo.rc file which would look something like this:
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
#include "afxres.h"
#undef APSTUDIO_READONLY_SYMBOLS
#ifdef APSTUDIO_INVOKED
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#ifdef MYLANGUAGE_CZ\r\n"
"#include ""Demo_CZ.rc""\r\n"
"#endif\r\n"
"\r\n"
"#ifdef MYLANGUAGE_EN\r\n"
"#include ""Demo_EN.rc""\r\n"
"#endif\r\n"
"\0"
END
#endif
#ifndef APSTUDIO_INVOKED
#ifdef MYLANGUAGE_CZ
#include "Demo_CZ.rc"
#endif
#ifdef MYLANGUAGE_EN
#include "Demo_EN.rc"
#endif
#endif
- Add the standard resource file (renamed to Demo_EN.rc) into the project (Menu/Project/Add To Project/Files)
- Go to Menu/Build/Configurations and add appropriate build configuration (Add... e.g. Release English, Copy from: Release)
- Go to Menu/Project/Settings, select your newly added Release English configuration
- Switch to General tab, change the intermediate and output files location - just enter Release
- Switch to Link tab and change the output file name to Release/Demo_EN.exe
- Switch to Resources tab, Resource file name: Release/Demo_EN.res, preprocessor definitions: insert the string MYLANGUAGE_EN, change the Language to English (if not selected)
- Follow steps 3-5 for each language version you want to build
- For each new language version, add these lines into Demo.rc file:
"#ifdef MYLANGUAGE_CZ\r\n"
"#include ""Demo_CZ.rc""\r\n"
"#endif\r\n"
"\r\n"
#ifdef MYLANGUAGE_CZ
#include "Demo_CZ.rc"
#endif
Note: For ATL projects you must keep the typelib
in Demo.rc:
1 TYPELIB "Demo.tlb"