Example #1
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                TwoPoint temp = Start();
                Microsoft.Xna.Framework.Input.Mouse.SetPosition((temp.a.X * Stride) + InitialPosition.X, (temp.a.Y * Stride) + InitialPosition.Y);
                MouseHookManager.mouse_event(0x02 | 0x04, (uint)temp.a.X, (uint)temp.a.Y, 0, 0);

                //System.Threading.Thread.Sleep(500);

                Microsoft.Xna.Framework.Input.Mouse.SetPosition((temp.b.X * Stride) + InitialPosition.X, (temp.b.Y * Stride) + InitialPosition.Y);
                MouseHookManager.mouse_event(0x02 | 0x04, (uint)temp.b.X, (uint)temp.b.Y, 0, 0);

                //System.Threading.Thread.Sleep(500);

                Microsoft.Xna.Framework.Input.Mouse.SetPosition(InitialPosition.X, InitialPosition.Y);

                System.Threading.Thread.Sleep(50);
                NativeWin32.SetForegroundWindow(this.Handle);
            }
        }