Input Method Editor (IME) Program Design (2)

Source: Internet
Author: User

Correct the translation. I will change it at any time :)

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 usingCreatemediawexFunction. 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.

 

The "ime" window class is a predefined system global class that defines the appearance and behavior of a standard IME window. In useCreatemediawexWhen a function generates a window, this class is similar to a common control class. Like static controls, the IME window class does not respond to user input. Instead, it notifies the ime of user input operations and processes the control messages sent to the IME or application in response to user behavior.

IME-aware applications sometimes use the ime class to create their own IME windows. In this way, when the package contains a window Positioning Control, the application can use the default data processing of the IME window.

 

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 sendsWm_ime_setcontextMessage to the application when a window is activated. ime-Unaware application pass these messages toDefwindowprocFunction 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 usingWm_ime_controlMessage. The IME notifies the application about changes to the composition string by usingWm_ime_compositionMessage and about general changes to the status of the ime windows by sendingWm_ime_policyMessage.

 

When some events that affect the IME window occur, the system sends an IME window message to the window procedure of the application. For example, when the (Application) window is activated, the system will sendWm_ime_setcontextMessage. IME applications that do not have a sense of the type will pass these messagesDefwindowprocFunction. The function sends them to the corresponding IME window. IME-aware applications also send these messages or send them to their own IME windows.

You can directly control the IME window to execute commands, suchWm_ime_controlMessage to change the position of the composition window. IME will useWm_ime_compositionMessage to notify the application about the change in the letter combination string, or useWm_ime_policyMessage to notify you of the normal changes to the status of the IME window.

 

Input Context

AnInput ContextIs 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.

 

The input context is a built-in structure maintained by IME. It contains information about the ime status used by the IME window. By default, the system creates and specifies an input context for each thread. In the thread, the default input context is a shared resource and will be associated with each new window.

 

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 usingImmgetcontextFunction. you can use the retrieved handle in subsequent callto 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 usingImmreleasecontextFunction.

 

To retrieve or set information in ime, the application must first obtain a handle for the input context associated with the specified window. You can useImmgetcontextFunction to obtain the handle. In subsequent Input Method management function calls, you can use this handle to retrieve and set IME values, such as the style of a combination of letters window, a combination of letters, and the position of a status window. Once you have used the context, you must useImmreleasecontextFunction to release it.

 

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.

 

Because the default input context is a shared resource, any changes you make to it will be applied to all windows in the thread. However, you can override the default behavior by generating and associating one or more windows in the thread with your input context. (However, you can also override the default behavior by generating and associating one or more windows in the thread with the input context .) Your changes to your input context will only apply to the corresponding window.

 

You can create an input context by usingImmcreatecontextFunction. To assign the context to a window, callImmassociatecontextFunction. this function returns a handle to the previusly 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 has es 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 usingImmassociatecontextFunction. Then, callImmdestroycontextFunction.

 

You can callImmcreatecontextFunction to create an input context. To allocate the input context to a window, you must callImmassociatecontextFunction. This function returns a handle, which is the handle of the input context previously associated with the window. If no input context is associated with some windows, the handle returned by the function will be the Default Input Context (handle ). Generally, you need to save the handle (default handle). When you do not want to use your input context, reassociate it with the window.

After an input context is associated with a window, the system automatically selects the context when the window is activated and the input focus is accepted. The format (style) and other information in the input context affect subsequent keyboard input in this window-determines whether or not to operate ime.

Before you end the application, you must destroy all input contexts that you have created. First, you must useImmassociatecontextThe function removes the input context from all associated windows in the thread. Then, callImmdestroycontextFunction.

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.