Appendix D: IME Messages on Windows
As was discussed in section on IME code integration, end user is responsible for wrapping all of the WM_IME messages into GFx::IMEWin32Event and passing them to the movie view. This section presents a brief introduction to these messages and the role they play in GFxIME.
- WM_IME_SETCONTEXT: Sent by IME to an application whenever the state of the IME windows changes (resizing/moving etc). According to the MSDN documentation, one of the parameters to this message contains certain flags that can be set/unset to show/hide IME windows. We found that in practice this doesn’t work.
- WM_IME_STARTCOMPOSITION: Sent immediately before the IME generates the composition string as a result of a keystroke.
- WM_IME_ENDCOMPOSITION: Sent to an application when the IME ends string composition. Note that with some Chinese IMEs the WM_END_COMPOSITION message is not sent even when the composition string is finalized.
- WM_IME_COMPOSITION: The WM_IME_COMPOSITION message is sent to an application when the IME changes composition status as a result of a keystroke. This message can be processed to obtain information about various types of composition events - change in the result string, clause information, etc. This is documented in the MSDN documentation. Note that on Windows XP, for certain IMEs (Chinese (Traditional) - New Phonetic and Chinese (Traditional) - New ChangJie for example), a space is inserted at the caret position in the text field as the reading window text is being input. For other IME’s (Chinese (Simplified) – QuanPin and Chinese (Traditional) – DaYi), the composition text is empty until the user is finished with typing in text for the reading window and sends the reading text to the IME for conversion into a composition character (usually by pushing the space key). On Windows Vista, the behavior is more consistent.
- WM_IME_NOTIFY: The WM_IME_NOTIFY message is sent to an application to notify it of changes to the IME window. The wParam parameter specifies the type of change. This message tells us about events like opening/closing the candidate window, repositioning the composition/input/status windows. Note that on Windows XP, some IME’s use wParam = IMN_PRIVATE for handling backspace and space characters which is undocumented behavior.
Detailed information about these messages and other IME related information can be found in the MSDN docs on Microsoft’s website.