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 callGetSystemMetrics 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_CHARmessages.

状态窗口、字母组合窗口和列选窗口构成了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 Window Class

The "IME" window class is a predefined system global class that defines the appearance and behavior of the standard IME windows. The class is similar to common control classes in that you create a window of this class by using the CreateWindowEx function. Like static controls, an IME window does not respond to user input by itself. Instead, it notifies the IME of user input actions and processes control messages sent to it by the IME or applications to carry out a response to the user action.

IME-aware applications sometimes create their own IME windows using the IME class. This allows the application to take advantage of the default processing of the IME window while having control of the positioning of the window.

“IME”窗口类是一个预定义的系统全局类,它定义了标准IME窗口的外观与行为。在使用CreateWindowEx函数生成窗口时,这个类与普通的控件类很相似。像静态控件一样,IME窗口类自己不响应用户的输入。取而代之,它将用户的输入操作通知给IME并且处理由IME或者应用程序为了响应用户行为而发送给它的控制消息。

IME感知类型的应用程序有时会应用IME类创建自己的IME窗口。这样当程序包含有窗口定位控件时就允许应用程序利用IME窗口的默认数据处理。

IME Messages

The system sends IME window messages to the window procedure of the application when certain events occur that affect the IME windows. For example, the system sends the WM_IME_SETCONTEXTmessage to the application when a window is activated. IME-unaware application pass these messages to the DefWindowProc function which sends them to the corresponding default IME window. IME-aware applications either process these messages or forward them to their own IME windows.

You can direct an IME window to carry out a command, such as change the position of composition window, by using the WM_IME_CONTROL message. The IME notifies the application about changes to the composition string by using the WM_IME_COMPOSITION message and about general changes to the status of the IME windows by sending the WM_IME_NOTIFY message.

当某些能影响IME窗口的事件发生时,系统将向应用程序的窗口过程(window procedure)发送IME窗口消息。例如:当(应用程序的)窗口激活时系统将向应用程序发送WM_IME_SETCONTEXT消息。IME无感知类型的应用程序会把这些消息传递给DefWindowProc 函数,函数会把它们发送给相应的IME窗口。IME感知型的应用程序也会将这些消息或者把这些消息传递给自己的IME窗口。

你可以直接控制IME窗口来执行命令,诸如可以用WM_IME_CONTROL消息来改变字母组合窗口(composition window,见上文)的位置。IME会使用WM_IME_COMPOSITION消息来通知应用程序关于字母组合字符串的变化,或用WM_IME_NOTIFY消息来通知关于IME窗口状态的常规改变。

Input Context

An input context is an internal structure, maintained by the IME, that contains information about the status of the IME and is used by IME windows. By default, the system creates and assigns an input context to each thread. Within the thread, this default input context is a shared resource and is associated with each newly created window.

输入上下文(Input context)是一个内置结构,由IME来维护,它包含了IME窗口所使用的有关IME状态的信息。默认情况下,系统会为每一个线程创建并指定一个输入上下文。在线程中,这个默认的输入上下文是一个共享资源,并且将会与每个新建窗口关联。

To retrieve or set information in the IME, an application must first retrieve a handle to the input context associated with a specified window. You retrieve the handle by using theImmGetContext function. You can use the retrieved handle in subsequent calls to the input method manager functions to retrieve and set IME values, such as the composition window style, the composition style, and the status window position. Once you have finished using the context, you must release it using the ImmReleaseContext function.

要在IME中检索或设置信息,应用程序必须首先获得一个与指定窗口相关联的输入上下文的句柄。你可以通过ImmGetContext函数来获得这个句柄。在随后的输入法管理函数调用中,你可以使用这个句柄来检索和设置IME的值,诸如字母组合窗口的风格、字母组合的风格以及状态窗口的位置等。一旦你完成了上下文的使用,你就必须使用ImmReleaseContext函数来释放它。

Because the default input context is a shared resource, any changes you make to it apply to all windows in the thread. However, you can override this default behavior by creating and associating your own input context to one or more windows of the thread. The changes you make to your own input context apply only to the windows with which it is associated.

因为默认的输入上下文是一个共享资源,你对它的任何改变都将应用于线程中的所有窗口。不过,你可以通过为线程中的一个或多个窗口生成并关联自己的输入上下文的方法来重写默认的行为。(不过,你也可以重写默认的行为,方法是为线程中的一个或多个窗口生成并关联自己输入上下文。)你对自己的输入上下文所做的改动将仅应用于与其相关的窗口上。

You can create an input context by using the ImmCreateContext function. To assign the context to a window, call the ImmAssociateContext function. This function returns a handle to the previously associated input context. If you have not associated an input context with the window before, the returned handle is for the default input context. Typically, you save this handle and later reassociate it with the window when you no longer want to use your own input context.

Once an input context is associated with a window, the system automatically selects that context when the window is activated and receives the input focus. The style and other information in the input context affects subsequent keyboard input for that window, determining whether and how the IME operates.

You must destroy any input context you create before terminating your application. First, you must remove the input context from any association it has with windows in the thread by using theImmAssociateContext function. Then, call the ImmDestroyContext function.

你可以用调用ImmCreateContext函数来创建一个输入上下文。要把输入上下文分配给一个窗口,需要调用ImmAssociateContext函数。这个函数将返回一个句柄,这个句柄是先前与窗口关联的输入上下文的句柄。如果先前没有输入上下文与些窗口相关联,函数将返回的句柄将是默认输入上下文(的句柄)。通常,你需要保存这个句柄(默认句柄),当你不想再使用自己的输入上下文时,再把它与窗口重新关联上。

在一个输入上下文与一个窗口关联后,当窗口被激活时并且接受输入焦点时,系统会自动选择那个上下文。输入上下文中的格式(style)和其它信息会影响此窗口随后的键盘输入——决定IME是否和如何操作。

在结束应用程序之前,你必须销毁所有你创建的输入上下文。首先,你必须使用ImmAssociateContext函数从线程中所有与之有关联的窗口上移除输入上下文。然后,调用ImmDestroyContext函数。

转载地址:http://blog.sina.com.cn/s/blog_65b22bb50100htu4.html

Windows IME (一)相关推荐

  1. Windows 系统优化与瘦身

    1.打开"我的电脑"-"工具"-"文件夹选项"-"查看"-在"显示所有文件和文件夹"选项前打勾-&q ...

  2. Windows Server 2003显示中文为乱码(方框)的问题

    问题描述:点击--开始--后菜单中文名称显示成方块,打开"我的电脑"也有乱码. 解决方法:如果系统是系统乱码的话,建议到正常的电脑上拷贝文件文件夹(C:\WINDOWS\ime), ...

  3. 服务器c盘windows文件夹太大,Win10C盘windows文件夹过大怎么办?Win10C盘windows文件夹过大的解决方法...

    在我们使用win10操作系统的时候会发现,C盘的windows文件夹内存占用空间特别大,那么应该如何删除或者清理这个windows文件夹内的东西呢?下面就和小编一起来看看有什么方法吧. Win10C盘 ...

  4. 如何有效的为Windows XP减肥

    Windows XP安装好后约有1.5GB,其中有一部分文件用途不大,可以将其删除.另外,系统在使用一段时间后也会产生大量的无用文件,这些无用文件既占用的磁盘空间,也影响磁盘读取的速度,应该将它们及时 ...

  5. Windows 10 解决无法完整下载安装语言包(日语输入法无法下载使用)

    最近我想在我的 Windows 10 上安装一个新的语言包,在 "设置" -> "时间和语言" -> "语言" 中,添加了新的语 ...

  6. windows 用户的完美“瘦身”攻略

    第一步就是开启 Administrator 帐户,先取得最高管理权限,方法: 右键桌面计算机--管理,本地用户和组--用户,右键 Administrator--属性,去除"帐户已禁用&quo ...

  7. 如何提高Windows 系统性能

    提高系统运行速度,对于学编程的人来说,还是有点重要的. 综合网上的资料,我总结了一些提高系统性能的方法: 使用下面的方法,最好是有一点电脑基础知识的.不然系统崩溃了别找我哦! 一.清理系统垃圾: 系统 ...

  8. windows和linux系统文件目录

    linux: /bin:二进制可执行命令.   /dev:设备特殊文件.   /etc:系统管理和配置文件.   /etc/rc.d:启动的配 置文件和脚本.   /home:用户主目录的基点,比如用 ...

  9. Windows系统中如何释放C盘空间

    Windows系统中如何释放C盘空间 1.打开"我的电脑"-"工具"-"文件夹选项"-"查看"-在"显示所有文 ...

  10. Windows系统精华

    140个计算机操作技巧 1. 重装Windows XP不需再激活 如果你需要重装Windows XP,通常必须重新激活.事实上只要在第一次激活时,备份好Windows\System32目录中的Wpa. ...

最新文章

  1. fastJson结合Nutz.Mapl的进阶应用
  2. python自动化干什么-Python接口自动化测试(一)什么是接口?
  3. 计算机网络:第五章 传输层
  4. [转帖]Mootools源码分析-04 -- Array
  5. 新手学C语言会踩到什么样的坑?
  6. 外设驱动库开发笔记4:AD9833函数发生器驱动
  7. 渗透中Meterpreter基本操作和对应的windows上的排查或者现象
  8. sql for xml path用法
  9. 去除DataTable重复数据的三种方法(转)
  10. curl安装使用【超级无敌简单】
  11. easyui select 默认选中指定值
  12. 所谓区块链,信息化的族谱而已——简单区块链python代码示例
  13. A Re-evaluation of Temporal Knowledge Graph Completion Models under a Unified Framework
  14. matlab里的dsolve,matlab_dsolve
  15. 如何使用vsCode+Icarus verilog+GTKwave编写并仿真verilog
  16. 让你效率飞起的右键工具——超级右键
  17. 成语——》寻找心中的巴拿马
  18. ROC曲线和PR曲线,AP,mAP
  19. 机器学习-Precision(查准率)、Recall(查全率)、P-R曲线
  20. easyMock服务搭建及使用

热门文章

  1. 已知分布函数求概率密度例题_助力高考:吃透数学17个必考题型,必定可以考130!(内附解题技巧+例题解析)...
  2. windows上的左斜杠和linux上的右斜杠的记忆方式
  3. 粒子群matlab工具箱,Matlab粒子群算法工具箱使用方法及实例演示
  4. echarts(雷达图和中国地图)
  5. uniapp 压缩图片(微信小程序)
  6. docker Got permission denied while trying to connect
  7. 程序员面试金典--疯狂刷
  8. 你应当知道的人工智能发展历史
  9. LeetCode 01:有人相爱,有人夜里开车看海,有人LeetCode第一题都做不出来
  10. 成果丰硕!SWORD 斯沃德惊艳亮相“第18届深圳名品家博会”