The IMEs need to generate IME messages. When the IME starts a conversion, the IME must generate the WM_IME_STARTCOMPOSITION message. If the IME changes the composition string, the IME must generate the WM_IME_COMPOSITION message. The events from IMEs are realized as generating messages to the window that is associated with the input context. Basically, the IMEs use the lpdwTransKey buffer that is provided by the parameter of the ImeToAsciiEx function to generate the message. The IME puts the messages into the lpdwTransKey buffer when ImeToAsciiEx is called. Even if ImeToAsciiEx is not called, the IME can generate the message to the window that is associated with the input context by using the message buffer of the input context. The input context has the message buffer as a handle of a memory block. The IME puts the messages into the memory block that is provided by the handle of the message buffer. Then the IME calls ImmGenerateMessage. The ImmGenerateMessage function sends the messages that are stored in the message buffer to the proper window.