输入法编辑器(IME)程序设计(1)

转记:游戏的登录窗口需要制作自定义的输入法编辑器,以控制只输入英文和数字(考虑国际化的问题)以及一些特定的字符,找了下输入法编辑器方面的资料,找到这个翻译系列,于是可以乘凉了~~~
原链接: http://blog.csdn.net/FantasiaX/archive/2004/03/20/22042.aspx
 
原作者:刘铁猛
 
输入法编辑器(IME)程序设计(1)
头一次发译的东西,肯定会有不少错误,请大家多多斧正。
本人志在编写中国最出色的输入法,解放中国人的双手。
今从零起步,朝成夕可死也。
 

Input Method Editor

An input method editor (IME) is a program that allows computer users to enter complex characters and symbols, such as Japanese Kanji characters, by using a standard keyboard.
      
输入法编辑器( IME )是一个程序,这个程序允许计算机用户使用标准键盘就能输入复杂的字符与符号,例如日文中的汉字(严重反对!中文是世界上使用人口最多的文字,这里应该是中文才好!)字符。

This overview describes the IME and explains how to use the input method manager functions to create and manage IME windows.
  • About Input Method Editor
  • Using Input Method Editor
  • Input Method Editor Reference

本预览描述了 IME ,并且解释说明了如何使用输入法管理程序( IMM )函数来创建和管理 IME 窗口。

¨         关于输入法编辑器

¨         使用输入法编辑器

¨         输入法编辑器参考

About Input Method Editor

The input method editor relieves users of the need to remember all possible character values. Instead, the IME monitors the user's keystrokes, anticipates the characters the user may want, and presents a list of candidate characters from which to choose.

       输入法编辑器减轻了用户记住所有可能字符值的需要,取而代之, IME监控 用户的击键、预见用户可能期望的字符,并且提供一个可选字符的列表,用户可以从中选择想要的字符。

By default, the IME provides an IME window through which users enter keystrokes and view and select candidates. Applications can use the input method manager (IMM) functions and messages to create and manage their own IME windows, providing a custom interface while using the conversion capabilities of the IME.

       默认情况下, IME 提供了一个 IME 窗口,通过这个窗口,用户可以用键盘输入并且查看和选择想要的字符。应用程序可以使用输入法管理器( IMM )函数和消息来创建并且管理其自己的 IME 窗口(比如 QQ 里是五笔而 Word 里却是拼音),并在使用 IME 的转换功能时提供一个自定义接口(不太明白)。

IMM is only enabled on East Asian (Chinese, Japanese, Korean) localized Windows. On these systems, call GetSystemMetrics with SM_DBCSENABLED to determine if IMM is enabled. Note that Windows 2000 provides full-featured IME support in all localized language versions, however, that IMM is enabled only when an Asian language pack is installed. An IME-enabled application can call GetSystemMetrics with SM_IMMENABLED to determine if IMM is enabled.

       IMM 只在东亚(中国,日本,韩国)本地化的 Windows 中才可用。在这些系统中,以 SM_DBCSENABLED 消息调用 GetSystemMetrics 函数来确定 IMM 是否可用。注意, Windows 2000 在所有本地化版本中都提供了全功能的 IME 支持,然而仅在安装了亚洲语言包的时候 IMM 才可用。一个 IME-enabled IME 可用)的程序会以 SM_IMMENABLED 调用 GetSystemMetrics 函数来确定 IMM 是否可用。

 

Status, Composition, and Candidates Windows

The status, composition, and candidates windows form the user interface for the IME. The status window indicates that the IME is open and provides the user the means to set the conversion modes. The composition window appears when the user enters text and, depending on the conversion mode, either displays the text as entered or displays converted text. The candidates window appears in conjunction with the composition window. It contains a list of "candidates" (alternative characters) for the selected character or characters in the composition window. The user can scroll through the candidates list and select the desired characters, then return to the composition window. The user can compose the desired text in this way until the composition string is finalized and the window is closed. The IME sends the composed characters to the application in the form of WM_IME_CHAR or WM_IME_COMPOSITION/GCS_RESULT messages. If the application does not process these messages, the DefWindowProc function translates them into one or more WM_CHAR messages.

       状态窗口、字母组合窗口和列选窗口构成了 IME 的用户界面。状态窗口指示出 IME 处于开启状态并且提供给用户设置转换模式的方法。字母组合窗口会在用户输入字符的时候出现,其形式基于转换模式,同时显示已经输入的字母或者是已经转换了的字符。( conversion mode 转换模式 = 输入法,比如微软拼音、五笔字型……其实不同的输入法的本质是不同的转换规则。)列选窗口会紧挨着字母组合窗口显示。它包含了一个由“候选条目”构成的列表,此列表匹配选中字符或者是字母组合窗口中的字符。用户可以滚动列选窗口并且选择想要的字符,然后(焦点)返回到字母组合窗口。借此用户可以组合想要的文本直到字符组合成的字符串结束,窗口会关闭。 IME 将使用 WM_IME_CHAR WM_IME_COMPOSITION/GCS_RESULT 消息把组合好的字符发送给窗体中的应用程序。如果应用程序没有处理这些消息, DefWindowProc 函数会把它们翻译成一条或多条 WM_CHAR 消息。

By default, the system automatically creates and manages status, composition, and candidates windows for all windows that require text input. For many applications, this default processing is sufficient. These applications rely entirely on the system for IME support and are said to be IME-unaware because they are unaware of the many tasks the system carries out to manage the IME windows.

       默认情况下,系统会为所有要求输入文本的窗口自动生成并管理状态窗口、字母组合窗口和列选窗口。对于许多程序,这一默认处理已经足够了。这些完全依赖于系统提供 IME 支持的应用程序称为 IME-unaware IME 无感知)程序,原因在于它们对系统为管理 IME 窗口所完成的诸多任务毫无感觉。

An IME-aware application, on the other hand, participates in the creation and management of IME windows. Such applications control the operation, position, and appearance of the default windows by sending messages to and by intercepting and processing messages intended for these windows. In some cases, applications create their own IME windows and provide complete processing for their custom status, composition and candidates windows.

       相反,一个 IME-aware IME 感知)程序会参与 IME 窗口的创建与管理。例如程序可能通过发送或截取消息并且有目的地对这些( IME )窗口消息进行处理,来控制默认( IME )窗口的选项、位置和外观。有些情况下,应用程序会创建它们自己的 IME 窗口并且对其自定义的状态、字母组合和列选窗口提供完全的控制处理。

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(输入法编辑器(IME)程序设计(1))