QA: How can I disable SIP word completion?
Vassili Philippov (vasja@spbteam.com), November 07, 2001.
Question
My application prompts for a password in an edit box.
Although the 'password' style is set so that only
asterisks are displayed when characters are entered, if a
password has previously been entered then the 'Word
Completion' feature causes the previous password to be
suggested. How can I disable word completion for the password field?
Answer
You should add SIPF_DISABLECOMPLETION flag to the fdwFlags member of
of SIPINFO structure. Then set this SIPINFO using SHSipInfo
function. Here is code for that:
SIPINFO info;
SHSipInfo(SPI_GETSIPINFO, 0, &info, 0);
info.fdwFlags |= SIPF_DISABLECOMPLETION;
SHSipInfo(SPI_SETSIPINFO, 0, &info, 0);
But if SIP is already opened then it will not work. You have to close and open SIP
again. The following two lines do what is needed:
SHSipPreference(m_hWnd, SIP_FORCEDOWN);
SHSipPreference(m_hWnd, SIP_UP);
Restore word completion
We do not need to disable word completion for all input fields, only for password fields.
For that we will disable word completion when the password field receives focus and will
restore it when the password field loses the focus.
We should handle EN_SETFOCUS and EN_KILLFOCUS messages. The handles can
be like in the following example:
void CCompletionTestDlg::OnSetfocusPassword()
{
SIPINFO info;
SHSipInfo(SPI_GETSIPINFO, 0, &info, 0);
m_dwSipFlasg = info.fdwFlags;
info.fdwFlags |= SIPF_DISABLECOMPLETION;
SHSipInfo(SPI_SETSIPINFO, 0, &info, 0);
SHSipPreference(m_hWnd, SIP_FORCEDOWN);
SHSipPreference(m_hWnd, SIP_UP);
}
void CCompletionTestDlg::OnKillfocusPassword()
{
SIPINFO info;
SHSipInfo(SPI_GETSIPINFO, 0, &info, 0);
info.fdwFlags = m_dwSipFlasg;
SHSipInfo(SPI_SETSIPINFO, 0, &info, 0);
SHSipPreference(m_hWnd, SIP_FORCEDOWN);
SHSipPreference(m_hWnd, SIP_UP);
}
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/setcurrentim.html
QA: How can I set the qwerty keyboard as the current input method?
-
http://www.pocketpcdn.com/articles/im.html
Article: Custom input method for SIP
- 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