1. 关于mui 在WINDOWS2000 系统中的的资料,可以参考:
http://www.microsoft.com/china/windows2000/guide/server/features/MUI_cn.asp
WINCE 中具有类似的信息.
2.自己实现所需要的步骤:
添加MUI 组件 并选择多国语言以供选择
生成内核 并下载到目标机
3.关于MUI 的实现,我查找网络资料,转载在这里 供大家参考.
kernel32: Implement EnumUILanguages.
---
dlls/kernel/locale.c | 71 ++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 57 insertions(+), 14 deletions(-)
diff --git a/dlls/kernel/locale.c b/dlls/kernel/locale.c
index cf65b4a..80293ac 100644
--- a/dlls/kernel/locale.c
+++ b/dlls/kernel/locale.c
@@ -1784,7 +1784,7 @@ BOOL WINAPI IsValidLocale( LCID lcid, DW
static BOOL CALLBACK enum_lang_proc_a( HMODULE hModule, LPCSTR type,
- LPCSTR name, WORD LangID, LONG lParam )
+ LPCSTR name, WORD LangID, LONG_PTR lParam )
{
LOCALE_ENUMPROCA lpfnLocaleEnum = (LOCALE_ENUMPROCA)lParam;
char buf[20];
@@ -1794,7 +1794,7 @@ static BOOL CALLBACK enum_lang_proc_a( H
}
static BOOL CALLBACK enum_lang_proc_w( HMODULE hModule, LPCWSTR type,
- LPCWSTR name, WORD LangID, LONG lParam )
+ LPCWSTR name, WORD LangID, LONG_PTR lParam )
{
static const WCHAR formatW[] = {'%','0','8','x',0};
LOCALE_ENUMPROCW lpfnLocaleEnum = (LOCALE_ENUMPROCW)lParam;
@@ -3184,12 +3184,46 @@ BOOL WINAPI SetUserGeoID( GEOID GeoID )
return FALSE;
}
+typedef struct
+{
+ union
+ {
+ UILANGUAGE_ENUMPROCA procA;
+ UILANGUAGE_ENUMPROCW procW;
+ } u;
+ DWORD flags;
+ LONG_PTR param;
+} ENUM_UILANG_CALLBACK;
+
+static BOOL CALLBACK enum_uilang_proc_a( HMODULE hModule, LPCSTR type,
+ LPCSTR name, WORD LangID, LONG_PTR lParam )
+{
+ ENUM_UILANG_CALLBACK *enum_uilang = (ENUM_UILANG_CALLBACK *)lParam;
+ char buf[20];
+
+ sprintf(buf, "%08x", (UINT)LangID);
+ return enum_uilang->u.procA( buf, enum_uilang->param );
+}
+
+static BOOL CALLBACK enum_uilang_proc_w( HMODULE hModule, LPCWSTR type,
+ LPCWSTR name, WORD LangID, LONG_PTR lParam )
+{
+ static const WCHAR formatW[] = {'%','0','8','x',0};
+ ENUM_UILANG_CALLBACK *enum_uilang = (ENUM_UILANG_CALLBACK *)lParam;
+ WCHAR buf[20];
+
+ sprintfW( buf, formatW, (UINT)LangID );
+ return enum_uilang->u.procW( buf, enum_uilang->param );
+}
+
/******************************************************************************
* EnumUILanguagesA (KERNEL32.@)
*/
BOOL WINAPI EnumUILanguagesA(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
{
- static char value[] = "0409";
+ ENUM_UILANG_CALLBACK enum_uilang;
+
+ TRACE("%p, %lx, %lx\n", pUILangEnumProc, dwFlags, lParam);
if(!pUILangEnumProc) {
SetLastError(ERROR_INVALID_PARAMETER);
@@ -3200,11 +3234,14 @@ BOOL WINAPI EnumUILanguagesA(UILANGUAGE_
return FALSE;
}
- FIXME("%p, %lx, %lx calling pUILangEnumProc with %s\n",
- pUILangEnumProc, dwFlags, lParam, debugstr_a(value));
-
- pUILangEnumProc( value, lParam );
- return(TRUE);
+ enum_uilang.u.procA = pUILangEnumProc;
+ enum_uilang.flags = dwFlags;
+ enum_uilang.param = lParam;
+
+ EnumResourceLanguagesA( kernel32_handle, (LPCSTR)RT_STRING,
+ (LPCSTR)LOCALE_ILANGUAGE, enum_uilang_proc_a,
+ (LONG_PTR)&enum_uilang);
+ return TRUE;
}
/******************************************************************************
@@ -3212,7 +3249,10 @@ BOOL WINAPI EnumUILanguagesA(UILANGUAGE_
*/
BOOL WINAPI EnumUILanguagesW(UILANGUAGE_ENUMPROCW pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
{
- static WCHAR value[] = {'0','4','0','9',0};
+ ENUM_UILANG_CALLBACK enum_uilang;
+
+ TRACE("%p, %lx, %lx\n", pUILangEnumProc, dwFlags, lParam);
+
if(!pUILangEnumProc) {
SetLastError(ERROR_INVALID_PARAMETER);
@@ -3223,11 +3263,14 @@ BOOL WINAPI EnumUILanguagesW(UILANGUAGE_
return FALSE;
}
- FIXME("%p, %lx, %lx calling pUILangEnumProc with %s\n",
- pUILangEnumProc, dwFlags, lParam, debugstr_w(value));
-
- pUILangEnumProc( value, lParam );
- return(TRUE);
+ enum_uilang.u.procW = pUILangEnumProc;
+ enum_uilang.flags = dwFlags;
+ enum_uilang.param = lParam;
+
+ EnumResourceLanguagesW( kernel32_handle, (LPCWSTR)RT_STRING,
+ (LPCWSTR)LOCALE_ILANGUAGE, enum_uilang_proc_w,
+ (LONG_PTR)&enum_uilang);
+ return TRUE;
}
INT WINAPI GetGeoInfoW(GEOID GeoId, GEOTYPE GeoType, LPWSTR lpGeoData,
4.一个例子供大家参考.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/MUI_Sample_1.asp
| International Features |
Note: This documentation is preliminary and subject to change.
Note: The application sample must be compiled with the Windows SDK for Vista and Microsoft Visual Studio, and will run only on Windows Vista and later.
The Windows SDK for Vista includes an application sample to demonstrate MUI functions, most of which are new in Windows Vista. This application is in the form of a complete project that can be built either in Visual Studio or from the console command line. It can be found in the directory ProgramFiles\Microsoft SDKs\Windows\v1.0\Samples\MUIAppSample.
The application sample allows a user either to make an overt choice of user interface (UI) language or to fall back to established system and user preferences. The application implicitly passes the UI settings to embedded Windows Media Player and Internet Explorer controls, and to the Common Controls dialog box used for language selection. In addition, the application uses the GetFileMUIPath function to load a banner, providing a typical example of loading a non-Win32 resource according to UI language preferences.
This application is localized in five different languages:
Note: The locales and the banners displayed by the application sample have been chosen arbitrarily for demonstration purposes. The screenshot pictures shown in this topic are specific to these locales. The picture that shows what the user will first see when the application is launched is based on the assumption that the system default UI language is US English.
This sample is designed to run on x86 and x64 versions of Windows Vista. It is not designed to run on IA64 (Itanium) versions of Windows Vista, or server versions of x86 and x64 Windows Vista.
To run the sample, you must ensure that Windows Media Player is installed on your computer.
Windows Vista provides 12 API functions to allow developers to leverage the MUI technology. The code in MUIAppSample.cpp demonstrates five of these functions, as well as several other functions that are closely related to MUI technology.
| API function | Demonstrated by this sample |
|---|---|
| EnumUILanguages | Yes. The application function InitGlobalConfig calls this API function to verify that the default user UI language is supported and installed. This API function can also be used to obtain a complete list of supported and installed UI languages. |
| GetFileMUIInfo | No. |
| GetFileMUIPath | Yes. The application function LoadBanner calls this API function to identify the correct banner picture to load in the upper right panel, based on a language name. |
| GetSystemDefaultUILanguage | No. |
| GetSystemPreferredUILanguages | No. |
| GetThreadPreferredUILanguages | Yes. The application function FillUserAndSystemPreferredLanguages calls this API function to get a merged list of all languages in the fallback list. The return is used to populate the language list that the user sees in the UI Language Settings window upon selecting Windows Language Setting. When the application function calls the API function, there are no languages set specifically for the thread. However, passing the flags MUI_MERGE_SYSTEM_FALLBACK | MUI_MERGE_USER_FALLBACK to the API function ensures retrieval of a full list of user and system preferences. The application makes two calls to the API function, the first to determine the required buffer size, and the second to obtain the data. |
| GetThreadUILanguage | No. |
| GetUILanguageInfo | No. |
| GetUserDefaultUILanguage | Yes. InitGlobalConfig calls this API function to get the current user UI language. |
| GetUserPreferredUILanguages | No. |
| SetThreadPreferredUILanguages | Yes. InitGlobalConfig calls this API function to set the selected UI language. The application function ReloadUI does the same, and then reloads miscellaneous resources and sets window texts so that the UI language change takes immediate effect. The application function FillSystemPreferredLanguages also calls the API function with an empty language list to clear the Thread Preferred UI Languages list so that there is nothing to take priority over user and system preferences. |
| SetThreadUILanguage | No. |
In addition, the application sample demonstrates the use of the MUI-compatible functions and macros defined in the following table.
| API function/macro | Remarks |
|---|---|
| EnumResourceLanguages | The application sample uses this function to list resource languages. Alternatively, the application could call EnumResourceLanguagesEx, to take more control over where to look for resources. The application shows one possible use of this API function, which is to determine the MUI languages supported by an application executable. |
| GetLocaleInfo | The application sample uses this function to retrieve locale data. Alternatively, the application could call GetLocaleInfoEx, passing a locale name instead of an LCID. |
| LCIDToLocaleName | The application sample uses this function to convert a language identifier to a language name. |
| LocaleNameToLCID | The application sample uses this function to convert a language name to a language identifier. |
| LANGIDFROMLCID | The application sample demonstrates the use of this macro. |
Two other MUI-related functions, LoadMUILibrary and FreeMUILibrary, help in writing applications that can run on pre-Windows Vista operating systems. Neither of these is demonstrated by the application sample. An example of the use of these functions can be found in the topic MUI and Downlevel Support.
To build this application sample from source, you must have the Windows SDK for Vista installed and registered. At least a Beta 2 version of the SDK is required.
Note: This sample is configured to build for x86 and x64 target platforms. The IA64 (Itanium) platform is not supported. If you are planning to build an x64 version of the sample, ensure that Visual Studio 2005 support for x64 is installed on your computer.
Before building the project, you must register the SDK directories with Visual Studio. To do this from the Start menu:
Pre-Release Only: When you click Register SDK Directories with Visual Studio, follow the displayed instructions to manually register the directories in Visual Studio. This manual registration is only temporary and will eventually become automatic.
Double-click on MUIAppSample.sln to start this project in Visual Studio. Then select the configuration (release/debug) and platform (win32/x64) and build the solution. The executable and the .mui files are placed in the \configuration\platform subdirectory.
To build the project from the command line:
vcbuild MUIAppSample.sln
The above procedure builds the sample for all available configurations and platforms. For more information about controlling the command line build, refer to the Vcbuild.exe command line help by typing the following:
vcbuild /?
When you build this sample, files are built separately for each language. Each build creates identical language-neutral MUIAppSample.exe and language-specific MUIAppSample.exe.mui files. In addition, various other files are copied to the appropriate release folders.
The resource configuration (RC Config) file Mui.rcconfig, common to all languages, indicates which resources are language-neutral and which are language-specific. It can also provide the checksum that is used to associate each language-specific .mui file with a particular version of the language-neutral portable executable (LN file), although it does not do this for the sample. As discussed in topics MUIRCT and RC Compiler, there are several ways to generate a checksum value that can be used for this purpose, and it does not have to be a true checksum.
During the build process for the sample, a Visual Studio project is set up for each language. In each project, the RC Compiler utility (Rc.exe) compiles and splits the non-localizable and localizable resources into two different object files, using the information in the RC Config file. The additional parameters passed to the RC Compiler can be seen in the property pages for the project under Configuration Properties → Resources → Command Line → Additional options.
As part of the normal Visual C++ build, which is a post-build event, the language-neutral resources are linked into an LN file, and the language-dependent resources are linked into a language-specific .mui file. The results of the event can be seen in the property pages for each language project under Configuration Properties → Build Events → Post-Build Event → Command Line. The LN files for each language are identical except for the checksum values in them.
The project must select a copy of the LN file as the base and arbitrarily chooses the file for English (US). The checksum value from this language is applied to the .mui files in another language using the MUIRCT utility.
As a final step in the build process, the project copies the files to the appropriate release folders in a MUI-compliant way.
The application sample is distributed as a ZIP file. The following table defines the files included in the ZIP file that are used to build the application.
| File | Notes |
|---|---|
| CCWindow.h, CCWindow.cpp |
Declare and implement the closed-caption window. |
| CWMPEventDispatch.h, CWMPEventDispatch.cpp |
Declare and implement the event dispatcher. |
| GlobalConfig.h | Declares a global structure to store information about the install language, the User Preferred UI Languages list and System Preferred UI Languages list, and the UI languages supported by the application sample, including the currently selected language. |
| IEController.h, IEController.cpp |
Declare and implement the container for the embedded Internet Explorer browser control. |
| Iectrl.h | Declares the embedded Internet Explorer browser object. |
| MPController.h, MPController.cpp |
Declare and implement the container for the embedded Windows Media Player control. |
| Mui.h | Declares the version resource for the application sample. This is a Visual Studio-generated resource header file. It is included in the .rc file so that the final binary will contain the version resource. |
| MUIAppSample.h, MUIAppSample.cpp |
Declare and implement the main code for the application. This code renders most of the MUI functionality. |
| Resource.h | Declares identifiers for resources in the application. |
| Stdafx.cpp, Stdafx.h |
Represent standard includes. |
| Wmp.h, Wmpids.h | Included by CWMPEventDispatch.h. |
The next table defines other files included in the ZIP file.
| File | Notes |
|---|---|
| Mui.rcconfig | Supports resource configuration (RC Config), which indicates the resources that are language-neutral and the ones that are language-specific. RC Config also provides the checksum that is used to associate the language-specific MUIAppSample.exe.mui files with this particular version of the language-neutral portable executable file MUIAppSample.exe. |
| MUIAppSample.ico | Defines the default 32x32-pixel application icon. |
| MUIAppSample.sln | Defines the Visual Studio "solution" file. |
| Multilang.smi | Supports multilingual closed captioning. |
| Multilang.wma | Supports a multimedia sample, with multiple audio streams. |
| Openfile.ico | Supports an Open File icon. |
| Small.ico | Supports a default 16x16-pixel application icon. |
The main source directory for the application sample also contains a "dll" folder containing sources related to the embedded Internet Explorer control, and a language folder for each supported language. Each language folder contains additional copies of the icon files and of Resource.h, plus the files defined in the following table.
| File | Notes |
|---|---|
| Banner.jpg | Shows an image appropriate to the locale. |
| <language>.rc | Indicates an appropriately named resource file for a language. For example, the English-language resource file is EN-US.rc. This file contains both language-specific resources and language-neutral resources. |
| <language>.vcproj | Indicates an appropriately named Visual Studio project file for a language. It is used in building the application for this language. |
For the application to run properly, certain files must be present on the target computer. When the release version of the application is built, the following files are placed in the Release directory:
The Release directory will also contain a language folder for each supported language. Each language folder contains two files:
Windows Vista does not come by default with the debug version of the Internet Explorer runtime library required to run a debug version of the application sample. To run the debug version of the operating system, you must install Visual Studio 2006 or .NET Framework 2.0 SDK on the computer used to run the debug version of the sample.
Once you launch the application, you will see the display shown below.

The left panel presents an embedded Internet Explorer browser. The upper right corner displays a banner picture and the closed caption window. The lower right corner displays an embedded Windows Media Player. The sole purpose of these controls is to demonstrate how MUI technology is used in Windows Vista and later.
The components here, Internet Explorer, Windows Media Player, the common dialog box obtained through the Open File icon, are MUI-enabled. The application sample is also MUI-enabled. When you change the UI language setting for this application, the UI immediately refreshes to its new locale.
Note: Although the embedded Internet Explorer component is MUI-enabled, the HTML page that it displays is not. Internet Explorer has an Accept Languages setting that controls the language(s) to use when rendering a Web page. This setting is not currently consistent with the MUI setting. Thus, if you right-click in the Internet Explorer window, the resulting context menu is in the correct language. However, an application UI setting does not affect the content of the displayed HTML page accessed in Internet Explorer. Another application, though, can have its own own language-specific HTML resource, just like this sample has its own language-specific .jpg resource.
To change the UI language setting for the application sample only, select Options → UI Language Settings. This selection only changes the language setting for the sample itself.
If necessary, you can set the application sample to use the language settings of the operating system. To do this, use the Control Panel to access the user's UI language preferences and then change the preferred language.
Once you have selected a different language, the UI for the application sample automatically refreshes. Because the UI components are MUI-enabled, the thread UI language of each component changes. For instance, you can right-click in the Internet Explorer window to bring up the context menu, which displays in the appropriate language.
The embedded Windows Media Player control can play multilingual multimedia files. It shows the closed caption in your current UI language, and plays the audio stream in that language. Try this feature using the sample media file Multilang.wma, included in the application sample package.
Note: You must explicitly select the file to view, using the Open File icon. No default multimedia file is provided.