예제 #1
0
            /// <summary>
            /// Links-Klick
            /// </summary>
            public static void MouseLeftClick()
            {
                //uint X = (uint)Cursor.Position.X;
                //uint Y = (uint)Cursor.Position.Y;
                //Win32User.mouse_event(Win32User.MOUSEEVENTF_LEFTDOWN | Win32User.MOUSEEVENTF_LEFTUP, X, Y, 0, 0);

                // oder

                //Win32User.mouse_event(Win32User.MOUSEEVENTF_LEFTDOWN, X, Y, 0, 0);
                //Win32User.mouse_event(Win32User.MOUSEEVENTF_LEFTUP, X, Y, 0, 0);

                Win32User.Input[] MouseEvent = new Win32User.Input[2];
                MouseEvent[0].Type = 0;
                MouseEvent[0].Data = new Win32User.MouseInput()
                {
                    X         = 0,
                    Y         = 0,
                    MouseData = 0,
                    Time      = 0,
                    DwFlags   = Win32User.MOUSEEVENTF_LEFTDOWN
                };
                MouseEvent[1].Type = 0;
                MouseEvent[1].Data = new Win32User.MouseInput()
                {
                    X         = 0,
                    Y         = 0,
                    MouseData = 0,
                    Time      = 0,
                    DwFlags   = Win32User.MOUSEEVENTF_LEFTUP
                };
                Win32User.SendInput((uint)MouseEvent.Length, MouseEvent, Marshal.SizeOf(MouseEvent[0].GetType()));
            }
예제 #2
0
            /// <summary>
            /// Mausbewegung
            /// </summary>
            /// <param name="x">neue Position</param>
            /// <param name="y">neue Position</param>
            public static void MouseMove(int x, int y)
            {
                x = x * 65535 / System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
                y = y * 65535 / System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;

                Win32User.Input[] MouseEvent = new Win32User.Input[1];
                MouseEvent[0].Type = 0;
                MouseEvent[0].Data = new Win32User.MouseInput()
                {
                    X         = x,
                    Y         = y,
                    MouseData = 0,
                    Time      = 0,
                    DwFlags   = Win32User.MOUSEEVENTF_ABSOLUTE | Win32User.MOUSEEVENTF_MOVE
                };
                Win32User.SendInput((uint)MouseEvent.Length, MouseEvent, Marshal.SizeOf(MouseEvent[0].GetType()));
            }