After you add code to respond to messages, you must add code to send messages from the application to the IME. These messages allow your application to request that IMEs handle positioning of the IME conversion window, enable or disable the display of the conversion window, use a particular font in the conversion window, and execute a particular virtual key. To send the IME a request, call the function SendIMEMessageEx, with wParam set to one of the constants listed in Figure 7-20. The return value SendIMEMessageEx will indicate the result of the subfunction.
SendIMEMessageEx Subfunction | Description |
IME_GETCONVERSIONMODE | Retrieves the mode of the IME. |
IME_GETOPEN | Retrieves the current status of the IME. |
IME_SETCONVERSIONWINDOW | Specifies the size and position of the bounding rectangle and the display start position of the conversion window. The IME displays an undetermined string at the position specified by this command. |
IME_GETIMECAPS | Checks whether a specific command is supported by the currently selected IME. |
IME_SELECT | Informs a selection of an IME. |
IME_SENDVKEY | Checks whether the IME supports virtual keys and if so, executes them. Virtual keys should begin with VK_. |
IME_SETCONVERSIONMODE | Sets the mode of the IME. |
IME_SETCONVERSIONFONTEX | Specifies a font for displaying an undetermined string in the conversion window. It differs from IME_SETCONVERSIONFONT in that it specifies the font using the logical font (LOGFONT) structure instead of a handle. The global memory containing the LOGFONT structure should be released by the application. |
IME_SETCONVERSIONFONT | Specifies a font for displaying an undetermined string in the conversion window. To display an undetermined string at the default position, use a system font. If the display position is the same size or shorter than the default position, enable the previously specified font. If NULL is specified as the font handle, a system font will be used. Windows NT does not support this command; it supports only IME_SETCONVERSIONFONTEX. |
IME_SETOPEN | Sets the status of the IME either to non-zero (to open the IME) or to zero (to close the IME). Returns the previous status. An undetermined string must not be determined if the IME has been closed. |
IME_ENTERWORDREGISTERMODE | Registers words and their readings as sent by applications. Includes parameters that describe parts of speech. |
Figure 7-20 SendIMEMessageEx subfunctions on Windows NT 3.5 under the Windows NT 3.5 IME model.
You will find that the two subfunctions IME_SETCONVERSIONWINDOW and IME_SETCONVERSIONFONT are particularly useful on Windows NT 3.5. Most existing applications position the conversion window next to the insertion point and request the IME to display the same font as the one used in the surrounding document. On Windows 95 these settings are the default, but on Windows NT 3.5 the default position for the IME conversion window is at the bottom of the screen, and characters in the conversion window are displayed in the system font.
The subfunction IME_SETCONVERSIONMODE can be called with one or more of the flags listed in Figure 7-21 to set the IME's conversion mode.
Conversion Mode | Description | Comments |
IME_MODE_ALPHANUMERIC | Alphanumeric | Cannot be simultaneously specified with IME_MODE _KATAKANA or IME_MODE_HIRAGANA |
IME_MODE_KATAKANA | Katakana | Cannot be simultaneously specified with IME_MODE_ALPHANUMERIC or IME_MODE_HIRAGANA |
IME_MODE_HIRAGANA | Hiragana | Cannot be simultaneously specified with IME_MODE_ALPHANUMERIC or IME_MODE_KATAKANA |
IME_MODE_SBCSCHAR | Single byte | Cannot be simultaneously character specified with IME_MODE_DBCSCHAR |
IME_MODE_DBCSCHAR | Double byte character | Cannot be simultaneously specified with IME_MODE_SBCSCHAR |
IME_MODE_ROMAN | Roman | Cannot be simultaneously character specified with IME_MODE_NOROMAN |
IME_MODE_NOROMAN | Non Roman | Cannot be simultaneously character specified with IME_MODE_ROMAN |
IME_MODE_CODEINPUT | Code input | Cannot be simultaneously specified with IME_MODE_NOCODEINPUT |
IME_MODE_NOCODEINPUT | Non-code | Cannot be simultaneously input specified with IME_MODE_CODEINPUT |
Figure 7-21 Possible flags for IME_SETCONVERSIONMODE under the Windows NT 3.5 IME model.