问题
I have the following problem:
I open the dialog, open the SIP keyboard to fill the form and then minimize the SIP. Then when I close the current dialog and return to the main dialog the SIP keyboard appears again. Does anyone know how could I show/hide SIP keyboard programatically or better what could be done to solve the described problem. Once the user minimizes the keyboard it should not appear on the screen on dialog switching.
Thanks!
回答1:
We use SHSipPreference to control the display of the SIP in our applications. I know it works with MFC and it sets the state of the SIP for the window so you can set it once and you know the SIP state will be restored to your set state every time the window is shown.
I've never heard of SipShowIM but I did see on the MSDN page linked:
The standard method of showing and hiding the SIP (SIPShowIM) exhibits some problems in MFC dialogs.
回答2:
You'll want to call SipShowIM() in coredll. See this MSDN article:
http://msdn.microsoft.com/en-us/library/ms838341.aspx
回答3:
You can use the Microsoft.WindowsCE.Forms.InputPanel component. You can show/hide the SIP programmatically using the Enabled property. There is an InputPanel component at the toolbox.
There is also an EnabledChanged event for the InputPanel that you can handle. You usually want to show the SIP at a GetFocus event of a textbox.
回答4:
Are you using MFC?
The problem is SIP state is per dialog, not per application. So you need to show/hide it inside every dialog independently.
void CAaa::OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized )
{
if(nState == WA_ACTIVE || nState == WA_CLICKACTIVE)
{
SHINITDLGINFO shidi;
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_FULLSCREENNOMENUBAR|SHIDIF_SIPDOWN | SHFS_HIDETASKBAR;
shidi.hDlg = m_hWnd;
SHInitDialog(&shidi);
SHFullScreen(m_hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON |SHFS_HIDESTARTICON);
}
}
And you should remove any Fullscreen or taskbar keys if not needed :)
And the other thing to use:
SHSipPreference(m_hWnd,SIP_UP); // SIP_DOWN
Or even:
HWND hwndCB = ::FindWindow(_T("SipWndClass"),_T(""));
::ShowWindow( hwndCB, SW_SHOW);
hwndCB = ::FindWindow(_T("MS_SIPBUTTON"),NULL);
::ShowWindow( hwndCB, SW_SHOW);
But the latter could be not so standard :) Still it works. Try them.
回答5:
...In some other dialog I want to set the keyboard layout to numeric, so I added the following line in the constructor: SendMessage(EM_SETINPUTMODE, 0, EIM_NUMBERS); However if I remove this line I solve one issue and create another one
GetLastError() is either 6 (invalid handle) or 120 (not supported). EM_SETINPUTMODE is only supported on SmartPhones, and SmartPhones don't have SIPs. See http://msdn.microsoft.com/en-us/library/bb416452.aspx.
来源:https://stackoverflow.com/questions/323874/how-to-show-hide-sip-on-pocket-pc