Share via


How to Access and Modify the Input Panel State

4/19/2010

For Windows Mobile Professional and Windows Mobile Classic, the SHSipInfo function provides a way to get information about the currently selected input panel, such as the state of the input panel (shown or hidden), its size and position on the display, and whether it is docked or floating. The same function also provides for changing input panel settings directly. SHSipInfo works primarily through the Windows Embedded CE SIPINFO structure.

Note

In most cases, a developer does not need to access direct information about the input panel, and the number of cases where these settings should be programmatically changed are fewer still. However, when this level of control is required, SHSipInfo provides a convenient way to directly manage the input panel.

The following code example shows how to use the SHSipInfo function to access and modify the SIPINFO structure.

BOOL LowerSip( void )
{
    BOOL fRes = FALSE;
    SIPINFO si;

    memset(&si, 0, sizeof(si));
    si.cbSize = sizeof(si);
    if(SHSipInfo(SPI_GETSIPINFO, 0, &si, 0)) 
    {
        si.fdwFlags &= ~SIPF_ON;
        fRes = SHSipInfo( SPI_SETSIPINFO, 0, &si, 0 );
    }

    return fRes;
}

When the user changes the input panel state, the operating system sends a WM_SETTINGCHANGE message to all active applications. This message has SPI_SETSIPINFO in its wParam parameter. The following code example shows how you can use the SHSipInfo function to move the input panel on the screen in response to a WM_SETTINGCHANGE message.

WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    SIPINFO si;
    switch( msg ) 
    {
        case WM_SETTINGCHANGE:
            switch( wParam ) 
            {
                case SPI_SETSIPINFO:
                    memset( &si, 0, sizeof( si ) );
                    si.cbSize = sizeof( si );
                    if( SHSipInfo( SPI_GETSIPINFO, 0, &si, 0 ) ) 
                    {
                        MoveWindow(
                            hwnd,
                            si.rcVisibleDesktop.left,
                            si.rcVisibleDesktop.top,
                            si.rcVisibleDesktop.right –
                            si.rcVisibleDesktop.left,
                            si.rcVisibleDesktop.bottom -
                            si.rcVisibleDesktop.top,
                            TRUE );
                    }
                    break;
            }
            break;
    }
return 0;
}

See Also

Concepts

Displaying or Hiding the Input Panel

Other Resources

Input Panel Programming Overview