Adding Code to Respond to IME Messages

The first order of business in supporting IMEs on Windows NT 3.5 is to add code that responds to messages sent by the active IME DLL. An IME-aware application traps the message WM_IME_REPORT. When an IME sends a WM_IME_REPORT message, it sets wParam to one of the values listed in Figure 7-19. The IME might send your application an entire string at once, in which case it sets wParam to IR_STRING, or the IME might send characters 1 byte at a time, in which case it sets wParam to IR_STRINGSTART to signal that the next WM_CHAR message will contain the beginning of a string. After the IME has transmitted the entire string, it will send another WM_IME_REPORT message, with wParam set to IR_STRINGEND.

wParam Value Description
IR_CHANGECONVERT Reports that the conversion window will change in status
IR_CLOSECONVERT Reports that the conversion window will close
IR_FULL_CONVERT Reports that the conversion window will overflow the bounding rectangle
IR_OPENCONVERT Reports that the conversion window will open
IR_STRING Reports a determined string
IR_STRINGEND Reports the end of determined-string transmission
IR_STRINGSTART Reports the start of determined-string transmission
IR_BASE_UI Reports the user interface
IR_ENHANCED_UI Reports the character-window–based user interface

Figure 7-19 Possible wParam values for the message WM_IME_REPORT under the Windows NT 3.5 IME model.

The Japanese Win32 SDK ships with sample code, called USEIME, that you can study for further details on implementing IME support for Windows NT 3.5.

On Windows NT 3.5, the standard IMEs are based on the appropriate local character set, such as Shift-JIS, rather than on Unicode. The operating system automatically converts strings into Unicode if necessary. (See the section titled "Unicode on Windows NT" in Chapter 3.)