Ejemplo n.º 1
0
        public MacroMouse Wheel(WheelDirection Direction, double Count)
        {
            if (Count <= 0)
            {
                throw new ArgumentOutOfRangeException("Count");
            }

            MouseEvent E;

            if (Direction == WheelDirection.Up || Direction == WheelDirection.Down)
            {
                E = MouseEvent.MOUSEEVENTF_WHEEL;
            }
            else
            {
                E = MouseEvent.MOUSEEVENTF_HWHEEL;
            }

            int dwData = (int)(120.0 * Count);

            if (Direction == WheelDirection.Left || Direction == WheelDirection.Down)
            {
                dwData = -dwData;
            }

            StaticFunction.mouse_event((int)E, 0, 0, dwData, IntPtr.Zero);

            return(this);
        }
Ejemplo n.º 2
0
        public MacroMouse Up(MMouseButton Button)
        {
            if (KeyHolder.IsRegist(Button))
            {
                KeyHolder.Unregist(Button);
            }

            switch (Button)
            {
            case MMouseButton.Left:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_LEFTUP, 0, 0, 0, IntPtr.Zero);
                break;

            case MMouseButton.Right:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_RIGHTUP, 0, 0, 0, IntPtr.Zero);
                break;

            case MMouseButton.Middle:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_MIDDLEUP, 0, 0, 0, IntPtr.Zero);
                break;

            case MMouseButton.X1:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_XUP, 0, 0, 1, IntPtr.Zero);
                break;

            case MMouseButton.X2:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_XUP, 0, 0, 2, IntPtr.Zero);
                break;

            default:
                throw new ArgumentOutOfRangeException("Button");
            }

            return(this);
        }
Ejemplo n.º 3
0
        public MacroMouse Down(MMouseButton Button)
        {
            switch (Button)
            {
            case MMouseButton.Left:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, IntPtr.Zero);
                break;

            case MMouseButton.Right:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, IntPtr.Zero);
                break;

            case MMouseButton.Middle:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, IntPtr.Zero);
                break;

            case MMouseButton.X1:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_XDOWN, 0, 0, 1, IntPtr.Zero);
                break;

            case MMouseButton.X2:
                StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_XDOWN, 0, 0, 2, IntPtr.Zero);
                break;

            default:
                throw new ArgumentOutOfRangeException("Button");
            }

            return(this);
        }
Ejemplo n.º 4
0
        public MacroKeyboard Down(Key Key)
        {
            int num = KeyInterop.VirtualKeyFromKey(Key);

            StaticFunction.keybd_event((byte)num, (byte)(bScanDict.ContainsKey(num) ? bScanDict[num] : 0), 0, IntPtr.Zero);

            return(this);
        }
Ejemplo n.º 5
0
        public MacroKeyboard Up(Key Key)
        {
            if (KeyHolder.IsRegist(Key))
            {
                KeyHolder.Unregist(Key);
            }

            int num = KeyInterop.VirtualKeyFromKey(Key);

            StaticFunction.keybd_event((byte)num, (byte)(bScanDict.ContainsKey(num) ? bScanDict[num] : 0), 2, IntPtr.Zero);

            return(this);
        }
Ejemplo n.º 6
0
 public MKeyState GetKeyState(Key Key)
 {
     return(StaticFunction.GetAsyncKeyState(KeyInterop.VirtualKeyFromKey(Key)) == 0 ? MKeyState.U : MKeyState.D);
 }
Ejemplo n.º 7
0
        public MacroMouse Move(int X, int Y)
        {
            StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_MOVE, X, Y, 0, IntPtr.Zero);

            return(this);
        }
Ejemplo n.º 8
0
        public MacroMouse Move(MPoint Point)
        {
            StaticFunction.mouse_event((int)MouseEvent.MOUSEEVENTF_MOVE, Point.X, Point.Y, 0, IntPtr.Zero);

            return(this);
        }