Partager via


Programming Input Methods (Windows Embedded CE 6.0)

1/6/2010

An IM is an in-process Component Object Model (COM) server that implements the IInputMethod interface. Windows Embedded CE provides a default QWERTY keyboard IM to handle alphanumeric input. The IM manages the space inside the software-based 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 software-based input panel window. This action enables the IM window to respond to user input through the software-based input panel window; the IM does not have access to the WindowProc function of the software-based input panel window unless the IM subclasses that window. The IM usually converts user input into characters and sends those characters to the software-based input panel through the IIMCallback and IIMCallback2 interfaces.

To use an IM, the user first selects the IM from the software-based input panel dialog box or the Input Panel button. The software-based input panel loads the selected IM dynamically by calling the CoCreateInstance function. When the user selects a different IM, the software-based input panel frees the existing IM by calling the Release method on the interface pointer. The software-based input panel then calls IInputMethod methods to notify the IM of events and to request data. The software-based input panel implements and exposes the IIMCallback and IIMCallback2 interfaces. This interface lets the IM call the software-based input panel to send keystrokes to the application through GWES. The following table shows the methods that are available through the IIMCallback and IIMCallback2 interfaces.

Method Description

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.

IIMCallback::SendVirtualKey

Modifies the global key state.

IIMCallback::SetImInfo

Lets the IM change the icon of the software-based input panel and the visible state of the software-based input panel.

IIMCallback2::SendAlternatives2

Enables an IM to send an alternatives list to an input method editor (IME).

IIMCallback2::SendCharEvents

Sends Unicode characters to the window that currently has the focus.

IIMCallback2::SendString

Sends strings to the window that currently has the focus.

IIMCallback2::SendVirtualKey

Modifies the global key state.

IIMCallback2::SetImInfo

Lets the IM change the icon of the software-based input panel and the visible state of the software-based input panel.

In response to the software-based input panel calls to methods of the IInputMethod interface, an IM creates windows in the contexts of the software-based input panel thread. This way, the software-based 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 software-based 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.

If you develop your own IM module, you should have your setup application perform self-registration by calling the DllRegisterServer and DllUnregisterServer functions. Implement these functions in the IM server dynamic-link library (DLL). Optionally, you can set the registry values directly. The Input Panel properties dialog box does not provide any UI elements for the self-registration service.

See Also

Other Resources

Software-based Input Panel Application Development
Software-based Input Panel