Export (0) Print
Expand All

SatDLL Sample: Implements Multilingual Resources in a Win32 Application 

Download sample

The SatDLL sample demonstrates a number of things related to localization and globalization:

  • How to set up a solution that builds one main EXE file and individual satellite DLLs containing different language versions of the user interface.

  • The recommended way to implement a satellite DLL-loading mechanism with language fallback in case the selected language isn't available.

  • Code to detect the preferred language for the user interface on any version of Windows.

  • How to dynamically switch the user interface language upon a change request from a user (what is not demonstrated is how the user choice for the user interface language can be persisted).

  • How to use the generic character encoding mapping functions to be able to build ANSI and Unicode versions of an application from the same source code.

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

Building and Running the Sample

NoteNote

If you are running Visual C++ Express Edition, you might need to install the Platform SDK before running this sample. For information on how to do this, see How to: Use Visual C++ Express Edition with the Microsoft Platform SDK.

To build and run this sample

  1. Open the solution file satdll.sln.

  2. From the Build menu, click Build Solution.

  3. From the Debug menu, click Start Without Debugging.

In the default configuration, this solution builds a Unicode application which requires Windows 2000 or later with language support for Western European languages and Japanese installed to display all characters in the user interface correctly.

By changing the Character Set in the general project settings to "Use Multi-Byte Character Set" the sample can be compiled for earlier Windows platforms. You will only be able to switch between languages which are supported by the ANSI codepage for that earlier Windows version though (for example, you will not be able to display Japanese on a English version of Windows ME).

NoteNote

When debugging this sample, the current directory is the solution directory and not the Debug directory. For this reason, the directories for the satellite DLLs (1031, 1033, and 1041) are created in the solution directory. When you deliver your application to an end-user, these satellite DLL directories should, of course, be created in the directory where the main executable file is located.

Keywords

This sample demonstrates the following keywords:

LoadString; LoadMenu; LoadAccelerators; LoadIcon; LoadCursor; DialogBox; CreateFontIndirect; DrawText; InvalidateRect; UpdateWindow; DestroyMenu; SetMenu; DrawMenuBar; GetLocaleInfo; GetCurrentDirectory; FindFirstFile; FindNextFile; LoadLibrary; EnumResourceLanguages; GetVersionInfoEx; RegOpenKeyEx; RegQueryValueEx; RegCloseKey; GetUserDefaultUILanguage; GetUserDefaultLangID; _tWinMain; _tcscpy; _tcsncpy; _tcslen; _tcsclen; _tcscat; _ttoi; _itot

See Also

Community Additions

ADD
Show:
© 2014 Microsoft