Hi,
I want to display the SIP, but I want to display it a little higher on the screen than where it shows by default. Is there a way to position the SIP vertically?
Hi,
I want to display the SIP, but I want to display it a little higher on the screen than where it shows by default. Is there a way to position the SIP vertically?
Call SetSipInfo with the SIPF_DOCKED bit cleared and the desired position.
Yes, but it depends on the platform that you are running on; not all implementations of the SIP will let you move it around, particularly those on Windows Mobile. (Windows Mobile is based on Windows CE, essentially a specific version created via the Platform Builder, but not all devices running Windows CE have the same platform components "plugged in.") I blogged about doing this in an application that runs on a version of Windows CE a few months ago. You'll find example C# code there.
/// <summary>
/// Sets the location of the SIP
/// </summary>
/// <param name="x">x coordinate of the SIP</param>
/// <param name="y">y coordinate of the SIP</param>
public static void SetSipLocation(int x, int y)
{
try
{
NativeMethods.SIPINFO info = new NativeMethods.SIPINFO();
info.cbSize = Marshal.SizeOf(info);
if (NativeMethods.SipGetInfo(out info))
{
info.rcSipRect.right = (info.rcSipRect.right -
info.rcSipRect.left) + x;
info.rcSipRect.left = x;
info.rcSipRect.bottom = (info.rcSipRect.bottom -
info.rcSipRect.top) + y;
info.rcSipRect.top = y;
NativeMethods.SipSetInfo(out info);
}
}
catch (DllNotFoundException)
{
}
catch (MissingMethodException)
{
}
}
/// <summary>
/// This structure contains information about the current state of the input panel, such as the input panel size, screen location, docked status, and visibility status.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internal struct SIPINFO
{
/// <summary>
/// Size, in bytes, of the SIPINFO structure. This member must be filled in by the application with the size of operator. Because the system can check the size of the structure to determine the operating system version number, this member allows for future enhancements to the SIPINFO structure while maintaining backward compatibility.
/// </summary>
public int cbSize;
/// <summary>
/// Specifies flags representing state information of the input panel. It is any combination of the following bit flags:
/// Value Description
/// SIPF_DOCKED The input panel is docked, or not floating.
/// SIPF_LOCKED The input panel is locked, meaning that the user cannot change its visible status.
/// SIPF_OFF The input panel is off, or not visible.
/// SIPF_ON The input panel is on, or visible.
/// </summary>
public uint fdwFlags;
/// <summary>
/// Rectangle, in screen coordinates, that represents the area of the desktop not obscured by the input panel. If the input panel is floating, this rectangle is equivalent to the working area. Full-screen applications that respond to input panel size changes can set their window rectangle to this rectangle. If the input panel is docked but does not occupy an entire edge, then this rectangle represents the largest rectangle not obscured by the input panel. If an application wants to use the screen space around the input panel, it needs to reference rcSipRect.
/// </summary>
public RECT rcVisibleDesktop;
/// <summary>
/// Rectangle, in screen coordinates of the window rectangle and not the client area, the represents the size and location of the input panel. An application does not generally use this information unless it needs to wrap around a floating or a docked input panel that does not occupy an entire edge.
/// </summary>
public RECT rcSipRect;
/// <summary>
/// Specifies the size of the data pointed to by the pvImData member.
/// </summary>
public uint dwImDataSize;
/// <summary>
/// Void pointer to input method (IM)-defined data. The IM calls the IInputMethod::GetImData and IInputMethod::SetImData methods to send and receive information from this structure.
/// </summary>
public IntPtr pvImData;
}
/// <summary>
/// This structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internal struct RECT
{
/// <summary>
/// Specifies the x-coordinate of the upper-left corner of the rectangle.
/// </summary>
public int left;
/// <summary>
/// Specifies the y-coordinate of the upper-left corner of the rectangle.
/// </summary>
public int top;
/// <summary>
/// Specifies the x-coordinate of the lower-right corner of the rectangle.
/// </summary>
public int right;
/// <summary>
/// Specifies the y-coordinate of the lower-right corner of the rectangle.
/// </summary>
public int bottom;
}
In a NativeMethods class:
/// <summary>
/// This function receives information including the state of the software-based input panel, the area of the desktop that is not obscured by the software-based input panel, the screen coordinates of the software-based input panel, and information about the input method (IM) that the software-based input panel is currently using.
/// </summary>
/// <param name="info">[out] Pointer to the SIPINFO structure that contains information about the current software-based input panel.</param>
/// <returns>TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError.</returns>
[DllImport("coredll.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SipGetInfo(out SIPINFO info);