Windows Mobile Multi-national language implementation

Source: Internet
Author: User

Introduction of a multi-language implementation, which is also recommended by Microsoft, the Windows directory under Windows Mobile can see many files with the MUI suffix name, such as Shellres.dll.0804.mui, Shell.dll.0804.mui ... We can use a file viewer such as EXeScope.exe or resources hacker to see what these files are all about, and it's easy to see that there are some resource IDs and corresponding strings in the file. Maybe you wonder why. What's the effect of these documents? Decomposition below.

MUI is the abbreviation of Multilingual User interface, which means the multi-language UI, which is mainly used to realize the internationalization of software, which is the implementation of the multi-language version of software. In fact, a MUI file is also a DLL, but this DLL is a bit special, not as we have brought many function bodies outside of the DLL or call itself, but only string resources, so you can create a new DLL project under VS, no other code, Only the DLL's entry points are required:

#include "Windows.h"

/////////////////////////////////////////////////////////////////////////////

DLL Entry Point

extern "C"

BOOL WINAPI DllMain (HANDLE hinstance, DWORD dwreason, LPVOID lpreserved)

{

return TRUE;

}

In addition, as mentioned earlier, the DLL contains only string resources, so you must add a resource configuration file such as ***.rc, and add the corresponding string resource information inside, as follows:

Idr_hello_menubar MENU discardable

BEGIN

MENUITEM "Exit", Psp_dlgindirect

POPUP "Menu"

BEGIN

MENUITEM "Exit", Psp_dlgindirect

MENUITEM "Test", id_menu_test

End

End

Pay special attention here, because each MUI means that each DLL represents a language, so in the resource configuration file is the language of each string resource changes to achieve the effect of a multi-language, for example, you want to make a simplified Chinese version, you have to rebuild a DLL, Also create a resource configuration file, but you need to change the resource configuration script code just above to read:

Idr_hello_menubar MENU discardable

BEGIN

MENUITEM "Exit", Psp_dlgindirect

Popup "Menu"

BEGIN

MENUITEM "Exit", Psp_dlgindirect

MENUITEM "Test", id_menu_test

End

End

You can then share the Resources.h file that defines the resource ID with the same resource ID for multiple MUI files and applications.

You also need to add an export file such as ***.def to the DLL project, but you do not need to export the function name as follows:

LIBRARY "Hello.exe.0804.mui"

Exports

You may also ask, how does the application locate the language by matching the corresponding MUI file? Please see.

Just now said that the Windows directory has shellres.dll.0804.mui, in fact, the name of the MUI file has a certain rules to follow, is not a mess, first Shellres.dll indicates that this MUI file is specifically for Shellres.dll multi-language versions, and then for example Hello.exe.0804.mui This representation is dedicated to hello.exe. Then 0804 what does that mean, this is the Microsoft defined language ID is a hexadecimal number, for example, the ID of the Simplified Chinese is 0x0804, and the U.S. English ID is 0409. The language IDs of other countries can view the language Identifiers and Locales in the SDK.

How does the system implement the identification application using which MUI file? The default language ID for the system is recorded in the system registry Hkey_current_usercontrolpanel Desktopmultiuilanguageid. So the system is configured automatically based on this default ID, without the need for programmers to use code control. But one thing to be aware of is that MUI files and applications need to be placed in the same directory. When you use VS to generate an MUI file, you can set the project properties so that vs directly generates the MUI file, in the DLL project, project properties----linker----General, output file $ (OutDir)/your_mui_name, Only need to modify your_mui_name for you the corresponding MUI filename is ok.

Using the MUI to implement a multi-language version, you do not need to change your application's code, just add or remove separate MUI files directly, and MUI files and applications are highly detached and easy to manage.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.