Windows CE Chinese Input Method Editor

Source: Internet
Author: User
Tags thread

Ce contains a simplified Chinese input Method Editor, if you do not want to write your input method Editor, you can directly invoke the default. Before explaining the Chinese input Method Editor by the way of internationalization (internationalization), Chinese input and Input Method Editor is only a small part of the internationalization components. Internationalization is an important part in the process of writing software for different language users, and the internationalization component of CE contains many small components.

The following table describes the name and functionality of the component:

Name Function
Agfa Font Compression Support for font compression
Font version Because East Asian fonts occupy large memory, this component provides options for selecting different sizes of font files
Handwriting recognition Handwriting recognition engine
Multi-language user interface Available to end users for switching language types
National Language System National language support (including date, time, number, currency format)
Transcriber applications recognize handwriting recognition programs in English, French, and German
Unicode code support Ability to process and display Unicode codes
Japanese IME Japanese Input Method Editor
Korean IME Korean Input Method Editor
Simplified Chinese IME Simplified Chinese Input Method Editor
Shuang Pin IM Simplified Chinese double Spell Input method
GB18030 Converter Conversion between GB18030 and CE coding
Traditional Chinese IME Traditional Chinese Input Method Editor

These components are often encountered when customizing the kernel, especially the font version, and the choice of different fonts has a significant impact on the size of the entire kernel. When customizing the kernel, select the font version provided by PB should refer to the Help document titled "Font Versions", which lists in detail the file name, content, normal size, and compression size of the East Asian language fonts. In addition to choosing the right version of the font, you should also use the Agfa font compression technology, the advantage of the Agfa font compression technology is to be able to reduce the font occupied by ROM and ram space, but also to ensure that the compression and decompression after the data is not lost. If you use font compression, the AGFA compression technique compresses fonts into TrueType format and saves them as ". AC3" files, so CE first looks for files with the extension ". AC3" when using fonts. If you do not use font compression, CE will use uncompressed fonts, such as files with the ". TTF" ". TTC" extension. The following about the simplified Chinese Input Method Editor of the relevant knowledge.

The CE input Method system consists of the following parts:

IME (Input Method Editor) kernel. Includes content related to the language of the user input, such as input method, text library, etc.

IME interface. Includes Status window, writing window, candidate window, guide window

IMM (Input Method Manager). Responsible for communication between CE system, application and IME

Enter the context. Including user input status, etc.

IME control window. Responsible for sending an unhandled IME message to an IME

The working mechanism of input Method system is as follows:

When the input method system is started, the user presses the keyboard and the keyboard message is sent to the IME by IMM. The IME handles message content, depending on the contents of the keyboard message or the characters that are used to write, or generate commands. When the IME processes keyboard messages, it sends a notification message to the currently focused window, and if the window cannot handle IME notification messages, the notification message is sent to the IME control window, and the control window returns the message to Ime,ime to do the default processing work (the IME provides the complete user interface). For windows that can handle IME notification messages, called Ime-aware windows, the window that does not handle IME notification messages is the Ime-unaware window. Windows that can handle IME notification messages can implement custom input method editors through the IMM function.

Enter the context:

The input context stores the state information of the IME, which is the internal structure of the IME. For each thread, the system creates and assigns a default input context, and each window in the thread shares the contents of the input context. The structural body definition for the input context is contained in the help document titled "Inputcontext." As you see from the documentation, the input context contains the corresponding window handle, the writing window and the position of the Candidate window and Status window, the font, the message buffer, and so on. Use function Immgetcontext to get a handle to the input context of the specified window. Frees the specified input context with Immreleasecontext. If you do not want a window in one thread to share the same input context, you can call the function Immcreatecontext to create a new context and call the function Immassociatecontext to associate the newly created input context with the specified window. When this newly created context is not used, the immdestroycontext is invoked to free the memory. Call function IMMLOCKIMC can get a pointer to a specified input context through which the input context data can be accessed. Call function IMMUNLOCKIMC,IMMUNLOCKIMC after access to reduce the number of lock counts until the handle is freed. The example code for the input context is as follows:

HIMC hIMC = ImmCreateContext();  ///创建新的上下文
LPINPUTCONTEXT lpIC;
lpIC = ImmLockIMC(hIMC);
....................       ///使用lpIC访问上下文数据
ImmUnlockIMC(lpIC);
ImmAssociateContext(hWnd, hIMC);  ///与窗口关联
ImmDestroyContext(hIMC);     ///最后释放上下文

Here is an example code that calls the Chinese input method:

HIMC hIMC = ImmGetContext(hWnd);  ///hWnd为当前窗口句柄
POINT pt;
pt.x = 300;
pt.y = 200;
ImmSetStatusWindowPos(hIMC, &pt);   ///设置状态窗口位置
ImmSetOpenStatus(hIMC, TRUE);    ///打开中文输入法
ImmReleaseContext(hEdit, hIMC);     ///最后释放上下文

I found in the development process that not all IMM functions were valid and confirmed my findings by analyzing the Pocket IME source. However, the above functions can achieve the function, as long as the ability to open and use the Chinese input method is still satisfied.

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.