Visual Studio 6Visual C++ 7.0Windows 2000Visual C++ 6.0Windows XPMFCIntermediateDevVisual StudioWindowsC++
Build localized apps as separate executables






3.50/5 (2 votes)
Jul 27, 2002
1 min read

49541

614
How to build a separate executable for each language version.
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:
//Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS //////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" //////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS #ifdef APSTUDIO_INVOKED //////////////////////////////////////////////////////////// // // TEXTINCLUDE // 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 // APSTUDIO_INVOKED #ifndef APSTUDIO_INVOKED //////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // #ifdef MYLANGUAGE_CZ #include "Demo_CZ.rc" #endif #ifdef MYLANGUAGE_EN #include "Demo_EN.rc" #endif //////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED
- 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"