An IM is an in-process COM server that implements the IInputMethod interface. The Palm-size PC software provides a default keyboard IM and a character recognition IM. The IM manages the space inside the input panel’s window. Within this window, the IM is responsible for screen output and responding to user input. Typically, an IM creates a child window of the Input Panel window. This way, the IM window can respond to user input through the Input Panel window; the IM does not have access to the Input Panel window’s WndProc function unless the IM subclasses that window. The IM usually converts user input into characters and sends those characters to the input panel through the IMCallback interface.
In order to use an IM, the user first selects the IM from the Input Panel dialog box or Input Panel button. The input panel dynamically loads the selected IM by calling CoCreateInstance. When the user selects a different IM, the input panel frees the old IM by calling Release on the interface pointer. The input panel then calls IInputMethod methods to notify the IM of events and to request information. 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 the GWES. The following table shows the methods available through the IMCallback interface.
IMCallback method |
Description |
SetImInfo | Lets the IM change the input panel icon and the visible state of the input panel |
SendVirtualKey | Modifies the global key state |
SendCharEvents | Sends Unicode characters to the window with the current focus |
SendString | Sends strings to the window with the current focus |
In response to the input panel’s calls to IInputMethod, 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 simplicity, all calls to IIMCallback should be made in the input panel thread. That is, the IM should only call IIMCallback methods in response to a call coming through an IInputMethod method.
The IM can create worker threads. However, the IM should not create a separate thread for the UI. Only the thread that responds to IInputMethod methods should create and manipulate windows. If you must create a worker thread to implement the UI, do not have this thread call IIMCallback. This is because certain GWES window functions only work properly if they are classed from the same thread that created the window.
If you develop your own IM component, you should have your setup application perform self-registration by calling the DllRegisterServer and DllUnregisterServer functions. Implement these functions in the IM server 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.