private static void UnlockSIP()
 {
     SIPINFO info = new SIPINFO();
     info.Size = (uint)Marshal.SizeOf(typeof(SIPINFO));
     SipGetInfo(ref info);
     info.Flags &= ~(SIPFlags.SIPF_LOCKED | SIPFlags.SIPF_DOCKED);
     SipSetInfo(ref info);
 }
 private static void ShowSIP()
 {
     SIPINFO info = new SIPINFO();
     info.Size = (uint)Marshal.SizeOf(typeof(SIPINFO));
     SipGetInfo(ref info);
     info.Flags |= SIPFlags.SIPF_ON;
     SipSetInfo(ref info);
 }
 private static extern bool SipSetInfo(ref SIPINFO pSipInfo);
        private static void Show(Form form, int controlTop, int controlBottom)
        {
            #if (PocketPC || WindowsCE || Mobile)
            if (!Values.Settings.DeviceOptions.UseOnScreenKeyboard)
                return;

            SIPINFO info = new SIPINFO();
            info.Size = (uint)Marshal.SizeOf(typeof(SIPINFO));
            SipGetInfo(ref info);

            Size rSize = new Size(info.Rect.Right - info.Rect.Left, info.Rect.Bottom - info.Rect.Top);

            if ((form.Top + controlBottom + 20) >
                (form.Bottom - rSize.Height))
            {
                SetSipLocation(0, form.Top + controlTop - rSize.Height);
            }
            else
            {
                SetSipLocation(0, form.Bottom - rSize.Height);
            }

            ShowSIP();
            #endif
        }
        private static void SetSipLocation(int x, int y)
        {
            Size size = GetSipSize();
            RECT bounds = new RECT();
            bounds.Left = x;
            bounds.Top = y;
            bounds.Right = bounds.Left + size.Width;
            bounds.Bottom = bounds.Top + size.Height;

            SIPINFO info = new SIPINFO();
            info.Size = (uint)Marshal.SizeOf(typeof(SIPINFO));
            SipGetInfo(ref info);
            info.Size = (uint)Marshal.SizeOf(typeof(SIPINFO));
            info.Rect = bounds;

            SipSetInfo(ref info);
        }
 private static Size GetSipSize()
 {
     Size size = new Size();
     SIPINFO info = new SIPINFO();
     info.Size = (uint)Marshal.SizeOf(typeof(SIPINFO));
     SipGetInfo(ref info);
     size = new Size(info.Rect.Right - info.Rect.Left, info.Rect.Bottom - info.Rect.Top);
     return size;
 }
        public static void ShowOnTop(Form form)
        {
            #if (PocketPC || WindowsCE || Mobile)
            if (!Values.Settings.DeviceOptions.UseOnScreenKeyboard)
                return;

            SIPINFO info = new SIPINFO();
            info.Size = (uint)Marshal.SizeOf(typeof(SIPINFO));
            SipGetInfo(ref info);

            Size rSize = new Size(info.Rect.Right - info.Rect.Left, info.Rect.Bottom - info.Rect.Top);

            SetSipLocation(0, form.Top);

            ShowSIP();
            #endif
        }
        public static void Hide(Form form)
        {
            #if (PocketPC || WindowsCE || Mobile)
            if (!Values.Settings.DeviceOptions.UseOnScreenKeyboard)
                return;

            Size size = GetSipSize();
            RECT bounds = new RECT();
            bounds.Left = 0;
            bounds.Top = form.Bottom - size.Height;
            bounds.Right = bounds.Left + size.Width;
            bounds.Bottom = bounds.Top + size.Height;

            SIPINFO info = new SIPINFO();
            info.Size = (uint)Marshal.SizeOf(typeof(SIPINFO));
            SipGetInfo(ref info);
            info.Size = (uint)Marshal.SizeOf(typeof(SIPINFO));
            info.Rect = bounds;
            info.Flags &= ~SIPFlags.SIPF_ON;

            SipSetInfo(ref info);
            #endif
        }