Ejemplo n.º 1
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x0312)
            {
                var k = ((int)m.LParam >> 16) & 0xFFFF;
                if (k == (int)Keys.B)
                {
                    var intptr = NativeMethods.WindowFromPoint(Control.MousePosition.X, Control.MousePosition.Y);
                    Clipboard.SetText(intptr.ToString("X"));
                }
                if (_ys)
                {
                    var hWnd = new IntPtr(int.Parse(handleBox1.Text, System.Globalization.NumberStyles.HexNumber));
                    NativeMethods.SetForegroundWindow(new HandleRef(this, Handle));
                    if (k == 0x36)
                    {
                        SendKeys.SendWait("{F3}");
                        Thread.Sleep(1000);
                        SendKeys.SendWait("%");
                        SendKeys.SendWait("3");
                        Thread.Sleep(1000);
                        SendKeys.SendWait("%");
                        SendKeys.SendWait("5");
                        Thread.Sleep(4000);
                    }
                    else if (k == 0x37)
                    {
                        Point p1 = new Point(236, 131);
                        Point p2 = new Point(237, 137);
                        var   c1 = Screens.GetColorAt(p1, null);
                        var   c2 = Screens.GetColorAt(p2, null);

                        if ((c1.R == 102 && c1.G == 102 && c1.B == 85) && (c2.R == 204 && c2.G == 51 && c2.B == 0))
                        {
                            SendKeys.SendWait("{F3}");
                            Thread.Sleep(1000);
                            SendKeys.SendWait("%");
                            SendKeys.SendWait("9");
                            Thread.Sleep(1000);
                        }

                        SendKeys.SendWait("{F3}");
                        Thread.Sleep(1000);
                        SendKeys.SendWait("%");
                        SendKeys.SendWait("3");
                        Thread.Sleep(1000);
                        SendKeys.SendWait("%");
                        SendKeys.SendWait("5");
                        Thread.Sleep(4000);
                        SendKeys.SendWait("%");
                        SendKeys.SendWait("9");
                    }
                    else if (k == 0x38)
                    {
                        SendKeys.SendWait("{F3}");
                        Thread.Sleep(1000);
                        SendKeys.SendWait("%");
                        SendKeys.SendWait("3");
                        Thread.Sleep(1000);
                        SendKeys.SendWait("%");
                        SendKeys.SendWait("6");
                        Thread.Sleep(2000);
                        SendKeys.SendWait("%");
                        SendKeys.SendWait("3");
                        Thread.Sleep(1000);
                        SendKeys.SendWait("%");
                        SendKeys.SendWait("7");
                        Thread.Sleep(3000);
                    }
                    else if (k == 0x39)
                    {
                        while (true)
                        {
                            SendKeys.SendWait("{F10}");
                            Thread.Sleep(1000);
                        }
                    }
                }
            }
            base.WndProc(ref m);
        }