Share via


SatDLL Sample: Implements Multilingual Resources in a Win32 Application

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 intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To get samples and instructions for installing them:

To access samples from Visual Studio

  • On the Help menu, click Samples.

    By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.

  • For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.

Building and Running the Sample

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.

Note

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

Concepts

Localized Resources in MFC Applications: Satellite DLLs

Other Resources

International Samples

General Samples