输入法位置

来源:互联网 发布:网络漏洞有哪些 编辑:程序博客网 时间:2024/06/11 19:24

            //将输入面板上移50,开启输入法

            SIPINFO sipInfo = new SIPINFO(0);

            SipGetInfo(ref sipInfo);

 

 

            originalRect = new RECT();

            originalRect.Left = sipInfo.rcSipRect.X;

            originalRect.Top = sipInfo.rcSipRect.Y;

            originalRect.Right = sipInfo.rcSipRect.Right;

            originalRect.Bottom = sipInfo.rcSipRect.Height;

 

            RECT newRect = new RECT();

            newRect.Left = sipInfo.rcSipRect.X;

            newRect.Top = sipInfo.rcSipRect.Y - 50;

            newRect.Right = sipInfo.rcSipRect.Right;

            newRect.Bottom = sipInfo.rcSipRect.Height - 50;

 

            SipSetDefaultRect(ref newRect);

            sipClsid = inputPanel1.InputMethods[1].Clsid.GetHashCode();

            IntPtr pointClsid = new IntPtr(sipClsid);

            if (SipGetCurrentIM(ref pointClsid))

            {

                SipSetCurrentIM(ref pointClsid);

            }

            pointClsid = IntPtr.Zero;

            SipShowIM(SIPF_ON);

 

        [DllImport("coredll.dll")]

        public extern static void SipShowIM(uint dwFlag);

        [DllImport("coredll.dll")]

        public extern static bool SipSetDefaultRect(ref RECT rectf);

        [DllImport("coredll.dll")]

        public extern static bool SipSetCurrentIM(ref IntPtr cslid);

        [DllImport("coredll.dll")]

        public extern static bool SipGetCurrentIM(ref IntPtr cslid);

        [DllImport("coredll")]

        public extern static bool SipGetInfo(ref SIPINFO sipInfo);

原创粉丝点击