QA: How can I set the qwerty keyboard as the current input method?
Yaroslav Goncharov (yaroslav@softspb.com), November 09, 2001.
Question
My application needs to set qwerty keyboard as current input method. How can I do it?
Answer
You can use SipSetCurrentIM(CLSID *pClsid)method to set current
input method. Now we need to find class id for qwerty keyboard. The following
source code sets qwerty keyboard as current input method.
CLSID clsidQwertyIM = __uuidof(CMSQwertyIm);
::SipSetCurrentIM(&clsidQwertyIM);
However, this solution is not perfect. Lets imagine the situation when there
is no qwerty keyboard in the system or modern keyboard replaces default one. MSDN
says If the SIP is unable to load the IM, the default IM is loaded in
its place. But in fact, system can have unpredictable behavior in
this situation. For instance, Cassiopeia E-125 will deselect current IM and user
will not see SIP panel in response on SIP button mouse click. The following
method solves this problem.
#include
// This method sets qwerty keyboard as current IM
// RET: TRUE indicates success. FALSE indicates failure.
BOOL SetQwertyAsCurrentIM()
{
CLSID clsidQwertyIM = __uuidof(CMSQwertyIm);
CLSID clsidOldIM, clsidCurIM;
::SipGetCurrentIM(&clsidOldIM);
::SipSetCurrentIM(&clsidQwertyIM);
::SipGetCurrentIM(&clsidCurIM);
// check if qwerty was set
if (clsidQwertyIM != clsidCurIM) {
// set the old IM to avoid unpredictable behavior
::SipSetCurrentIM(&clsidOldIM);
return FALSE;
}
return TRUE;
}
Related resources:
-
http://www.pocketpcdn.com/sections/sip.html
Section: SIP
-
http://www.pocketpcdn.com/articles/sip.html
Article: Working with SIP
-
http://www.pocketpcdn.com/articles/im.html
Article: Custom input method for SIP
-
http://www.pocketpcdn.com/articles/wordcompletion.html
QA: How can I disable SIP word completion?
- http://www.microsoft.com/mobile/developer/technicalarticles/softinput.asp
Article: Showing and Hiding the Soft Input Panel in C++ Applications for the Pocket PC
- http://www.microsoft.com/mobile/developer/technicalarticles/softwareinput.asp
Article: Adding Software Input Panel Support to the Pocket PC Wizard Code
- http://support.microsoft.com/default.aspx?scid=kb;en-us;265799
Article: HOWTO: Activate the Soft Input Panel (SIP) from an eVB Application
- http://support.microsoft.com/default.aspx?scid=kb;en-us;Q262039
Article: Q262039 - BUG: eVB: SIP Key Events (Up, Press, Down) All Fire at the Same Time
- http://support.microsoft.com/default.aspx?scid=kb;en-us;Q262410
Article: Q262410 - PRB: eVB: Raising SIP Erases Items Drawn or Printed on a Form
- http://support.microsoft.com/default.aspx?scid=kb;en-us;Q275182
Article: Q275182 - PRB: FormResize Appears to Have No Effect When the SIP Is Shown
- http://www.codeproject.com/useritems/floatingsip.asp
Article: Enable floating SIP control in IPAQ/WindowsCE.NET
- http://www.microsoft.com/mspress/books/sampchap/5461b.asp#108
Article: Writing an Input Method
-
http://www.pocketpcdn.com/libraries/vbcesoftkeyboard.html
Control: vbceSoftKeyboard