Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This code sample is named DvorakSIP. It demonstrates how to create a custom Soft Input Panel (SIP) as a COM object. It is intended to help users and service providers in different regions support different languages in the SIP. The application is a COM component that implements the IInputMethodInterface.
Feature Area
Relevant APIs
IInputMethodInterface
Events
The following events occur when the user selects this input panel, and begins tapping keys.
- The system calls the DLL containing the code for the custom SIP
mechanism, which implements the
IInputMethodInterface.
- The
IInputMethod::Selectmethod is called to create the input window
using the Dvorak keyboard bitmap.
- The system calls
IInputMethod::GetInfoto get information in an
IMINFOstructure about the size and other aspects of the input
context.
- The system calls
IInputMethod::ReceiveSipInfoto inform the input method of size,
placement information. It reacts to this call by resizing itself
appropriately.
-
IInputMethod::RegisterCallbackis called to give the input
method a pointer to a
IIMCallbackinterface. This interface is used to return
keystrokes to applications.
- When the user taps a key on the keyboard, the input method
recognizes the mouse event location on its keyboard bitmap. It
scans the bitmap horizontally and vertically to place the tap
inside a particular key.
- A large array of constants is maintained, that define the value
of each key on the keyboard, and its pixel location so that this
scanning mechanism can be accomplished.
- The keystroke is processed and various flags are checked such
as CAPS lock, Shift, etc. Once the proper keystroke has been
determined, it is returned to the application using the
IIMCallback::SendCharEventsmethod.
IIMCallback::SendVirtualKeyis used if the virtual key code is
desired (an example could be when the Windows Key was pressed if
such a key exists on the keyboard).
- The state of the keyboard is updated as the key is no longer
pressed. Code must be careful to check for sticky keys such as CAPS
in this situation.
Usage
-
Navigate to the solution file (*.sln), and double-click it. By default, the solution file is copied to the following folder:
C:\Program Files\Windows Mobile 6.5.3 DTK\Samples\PocketPC\CPP\ATL\dvoraksip
Microsoft Visual Studio launches and loads the solution.
-
Build the solution (Ctrl+Shift+B).
-
Deploy the solution (F5).
-
Select the Dvorak SIP using the SIP button in the lower middle of the screen from within any application that supports the SIP (Word Mobile, Notes, etc.).
Remarks
The soft input panel (SIP) is designed to support user-defined input mechanisms. By default, it includes a Standard Keyboard, a Block Recognizer, and a Letter Recognizer.
IInputMethod::GetImData, IInputMethod::SetImData, IInputMethod::UserOptionsDlgcan simply return an HRESULT without any computation.
IInputMethod::UserOptionsDlgcan display the simple message "There are no options for this input method." This is just to show the function of the method so you can extend it further.
For more information on hardware-specific keyboard
layouts, see
If this sample is loaded at boot time as the default input method, it will only use the upper left quadrant of the SIP area.
Development Environments
Pocket PC SDK:Windows Mobile Professional SDK
Development Environment:Visual Studio 2005 or 2008.
ActiveSync:Version 4.5.