Using Japanese Input Methods (Windows CE 5.0)
An IM is an in-process Component Object Model (COM) server that implements the IInputMethod interface. Windows CE provides a default QWERTY keyboard IM to handle alphanumeric input. The IM manages the space inside the input panel window. Within this window, the IM is responsible for screen output and for responding to user input. Typically, an IM creates a child window of the input panel window. This action enables the IM window to respond to user input through the input panel window; the IM does not have access to the WindowProc function of the input panel window unless the IM subclasses that window. The IM usually converts user input into characters and sends those characters to the input panel through the IIMCallback interface.
In order to use an IM, the user first selects the IM from the input panel dialog box or the Input Panel button. The input panel loads the selected IM dynamically by calling the CoCreateInstance function. When the user selects a different IM, the input panel frees the existing IM by calling the IUnknown::Release method on the interface pointer. The input panel then calls IInputMethod methods to notify the IM of events and to request data. The input panel implements and exposes the IIMCallback interface. This interface lets the IM call the input panel to send keystrokes to the application through GWES. The following table shows the methods that are available through the IIMCallback interface.
IIMCallback method | Description |
---|---|
IIMCallback::SetImInfo | Lets the IM change the icon of the input panel and the visible state of the input panel. |
IIMCallback::SendVirtualKey | Modifies the global key state. |
IIMCallback::SendCharEvents | Sends Unicode characters to the window that currently has the focus. |
IIMCallback::SendString | Sends strings to the window that currently has the focus. |
In response to the input panel calls to methods of the IInputMethod interface, an IM creates windows in the contexts of the input panel thread. This way, the input panel and the IM belong to the same message loop. For purposes of simplicity, all calls to methods of the IIMCallback interface should be made in the input panel thread. That is, the IM should call IIMCallback methods only in response to a call coming through an IInputMethod method.
Additionally, the IM should not create a separate thread to implement a UI. Only the thread that responds to IInputMethod methods should create and manipulate windows. Instead, the IM can create process threads to implement a UI*.* However, these process threads must not call IIMCallback, because certain GWES window functions work properly only if they are created from the same thread that created the window.
See Also
Japanese Input Method Architecture | Japanese IM Search Panels | Japanese IM On-Screen Keyboards | IInputMethod | WindowProc | IIMCallback | CoCreateInstance | IUnknown::Release | IIMCallback::SendVirtualKey | IIMCallback::SendCharEvents | IIMCallback::SendString
Send Feedback on this topic to the authors