Пример #1
0
        /// <summary>
        /// 半后台绑定,不锁定鼠标输入
        /// </summary>
        public bool BindHalfBackground()
        {
            bool isMin = IsMin;

            if (IsBind)
            {
                if (BindType == WindowBindType.Half)
                {
                    return(true);
                }
                UnBind();
            }
            RestoreAndNotActive();
            int dmRet;

            if (Dm.IsFree)
            {
                dmRet = Dm.BindWindow(_hwnd, DmBindDisplay.dx, DmBindMouse.dx2, DmBindKeypad.dx, DmBindMode._0);
            }
            else
            {
                dmRet = Dm.BindWindowEx(
                    _hwnd,
                    "dx2",
                    "dx.mouse.position.lock.api|dx.mouse.focus.input.api|dx.mouse.focus.input.message|dx.mouse.clip.lock.api|dx.mouse.input.lock.api|dx.mouse.state.api|dx.mouse.api|dx.mouse.cursor",
                    "dx.keypad.input.lock.api|dx.keypad.state.api|dx.keypad.api",
                    "dx.public.active.api|dx.public.active.message",
                    DmBindMode._4);
            }
            if (dmRet == 0)
            {
                IsBind   = false;
                BindType = WindowBindType.None;
                return(false);
            }
            BindType = WindowBindType.Half;
            IsBind   = true;
            if (isMin)
            {
                Min();
            }
            return(true);
        }
Пример #2
0
        /// <summary>
        /// BindEx自定义绑定参数
        /// </summary>
        /// <param name="hwnd"></param>
        /// <param name="display"></param>
        /// <param name="mouse"></param>
        /// <param name="keypad"></param>
        /// <param name="_public"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public bool BindWindowEx(int hwnd, string display, string mouse, string keypad, string _public, DmBindMode mode)
        {
            if (IsBind)
            {
                if (BindType == WindowBindType.BindEx)
                {
                    return(true);
                }
                UnBind();
            }
            int dmRet = Dm.BindWindowEx(hwnd, display, mouse, keypad, _public, mode);

            if (dmRet == 0)
            {
                IsBind   = false;
                BindType = WindowBindType.None;
                return(false);
            }
            BindType = WindowBindType.BindEx;
            IsBind   = true;
            return(true);
        }
Пример #3
0
        /// <summary>
        /// 全后台绑定,锁定鼠标输入
        /// </summary>
        public bool BindFullBackground()
        {
            if (IsBind)
            {
                if (BindType == WindowBindType.Full)
                {
                    return(true);
                }
                UnBind();
            }
            RestoreAndNotActive();
            bool dmRet;

            if (Dm.IsFree)
            {
                dmRet = Dm.BindWindow(_hwnd, DmBindDisplay.dx, DmBindMouse.dx, DmBindKeypad.dx, DmBindMode._0);
            }
            else
            {
                dmRet = Dm.BindWindowEx(
                    _hwnd,
                    "dx2",
                    "dx.mouse.position.lock.api|dx.mouse.position.lock.message|dx.mouse.clip.lock.api|dx.mouse.input.lock.api|dx.mouse.state.api|dx.mouse.api|dx.mouse.cursor",
                    "dx.keypad.input.lock.api|dx.keypad.state.api|dx.keypad.api",
                    "dx.public.active.api|dx.public.active.message",
                    DmBindMode._4);
            }
            if (dmRet)
            {
                IsBind   = false;
                BindType = WindowBindType.None;
                return(false);
            }
            BindType = WindowBindType.Full;
            IsBind   = true;
            return(true);
        }
Пример #4
0
        /// <summary>
        /// 半后台绑定,不锁定鼠标输入
        /// </summary>
        public bool BindHalfBackgroundMoniqi()
        {
            bool isMin = IsMin;

            if (IsBind)
            {
                if (BindType == WindowBindType.Half)
                {
                    return(true);
                }
                UnBind();
            }
            RestoreAndNotActive();
            bool dmRet;

            if (Dm.IsFree)
            {
                dmRet = Dm.BindWindow(_hwnd, DmBindDisplay.dx, DmBindMouse.dx2, DmBindKeypad.dx, DmBindMode._0);
            }
            else
            {
                dmRet = Dm.BindWindowEx(_hwnd, "dx.graphic.opengl", "windows", "windows", "dx.public.graphic.protect|dx.public.anti.api|dx.public.input.ime", 0);
            }
            if (!dmRet)
            {
                IsBind   = false;
                BindType = WindowBindType.None;
                return(false);
            }
            BindType = WindowBindType.Half;
            IsBind   = true;
            if (isMin)
            {
                Min();
            }
            return(true);
        }