C#的鼠标控制代码

原文: http://free56.cn/post/10.html

C#的鼠标控制代码

// using System.Runtime.InteropServices;
 
        [Flags]
        enum MouseEventFlag : uint
        {
            Move = 0x0001,
            LeftDown = 0x0002,
            LeftUp = 0x0004,
            RightDown = 0x0008,
            RightUp = 0x0010,
            MiddleDown = 0x0020,
            MiddleUp = 0x0040,
            XDown = 0x0080,
            XUp = 0x0100,
            Wheel = 0x0800,
            VirtualDesk = 0x4000,
            Absolute = 0x8000
        }
        [DllImport("user32.dll")]
        static extern void mouse_event(MouseEventFlag flags, int dx, int dy, uint data, UIntPtr extraInfo);
        // only mouse move
        [DllImport("user32.dll")]
        static extern bool SetCursorPos(int X, int Y);
        // Get Cursor Positon
       [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "GetCursorPos")]
        public extern static int GetCursorPos(ref POINTAPI lpPoint);
原文: http://free56.cn/post/10.html 
原文地址:https://www.cnblogs.com/skywind/p/663107.html