Example #1
0
        public static void CreateMouseClick(int button, int times)
        {
            switch (button)
            {
            case 0:
                while (times-- > 0)
                {
                    WinAPIUtils.mouse_event(WinAPIUtils.MOUSEEVENTF_LEFTDOWN | WinAPIUtils.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
                }
                break;

            case 1:
                while (times-- > 0)
                {
                    WinAPIUtils.mouse_event(WinAPIUtils.MOUSEEVENTF_MIDDLEDOWN | WinAPIUtils.MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0);
                }
                break;

            case 2:
                while (times-- > 0)
                {
                    WinAPIUtils.mouse_event(WinAPIUtils.MOUSEEVENTF_RIGHTDOWN | WinAPIUtils.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
                }
                break;

            default:
                throw new Exception("Button can only be 0 ~ 2.");
            }
        }
Example #2
0
        public static void CreateMouseUp(int button)
        {
            switch (button)
            {
            case 0:
                WinAPIUtils.mouse_event(WinAPIUtils.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
                break;

            case 1:
                WinAPIUtils.mouse_event(WinAPIUtils.MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0);
                break;

            case 2:
                WinAPIUtils.mouse_event(WinAPIUtils.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
                break;

            default:
                throw new Exception("Button can only be 0 ~ 2.");
            }
        }