Exemplo n.º 1
0
        private void hook_KeyDown(object sender, KeyEventArgs e)
        {
            int buttonKey = (int)e.KeyCode;

            if (buttonKey == (int)Keys.Oem3) //截获~
            {
                runFlag = (!runFlag);
                if (runFlag)
                {
                    //timer2.Start();
                    timer3.Start();
                    timer4.Start();
                }
                else
                {
                    //timer2.Stop();
                    timer3.Stop();
                    timer4.Stop();
                }
                return;
            }
            else if (buttonKey == (int)Keys.D1)
            {
                IntPtr hwnd         = FindWindow(null, toolStripTextBoxWinName.Text);
                IntPtr activeWindow = GetForegroundWindow();
                if (activeWindow == hwnd)
                {
                    keybd_event(Keys.LShiftKey, 0, 0, 0);
                    MouseHook.MouseLeftClickEvent(0);
                    keybd_event(Keys.LShiftKey, 0, KEYEVENTF_KEYUP, 0);
                }
            }
        }
Exemplo n.º 2
0
        private void hook_KeyDown(object sender, KeyEventArgs e)
        {
            int buttonKey = (int)e.KeyCode;

            if (buttonKey == (int)Keys.Oem3) //截获~
            {
                runFlag = (!runFlag);
                this.ChangeStatus(runFlag);
                if (runFlag)
                {
                    timer1.Start();
                    //timer2.Start();
                    //timer3.Start();
                    //timer4.Start();
                    //timerR.Start();
                    //timerL.Start();
                }
                else
                {
                    keybd_event(Keys.LMenu, 0, KEYEVENTF_KEYUP, 0);
                    timer1.Stop();
                    //timer2.Stop();
                    //timer3.Stop();
                    //timer4.Stop();
                    //timerR.Stop();
                    //timerL.Stop();
                }
                return;
            }
            else if (buttonKey == (int)Keys.D1)
            {
                IntPtr hwnd         = FindWindow(null, toolStripTextBoxWinName.Text);
                IntPtr activeWindow = GetForegroundWindow();
                if (activeWindow == hwnd)
                {
                    if (runFlag)
                    {
                        keybd_event(Keys.LShiftKey, 0, 0, 0);
                        MouseHook.MouseLeftClickEvent(0);
                        keybd_event(Keys.LShiftKey, 0, KEYEVENTF_KEYUP, 0);
                    }
                }
            }
            else if (buttonKey == (int)Keys.NumPad1)
            {
                IntPtr hwnd         = FindWindow(null, toolStripTextBoxWinName.Text);
                IntPtr activeWindow = GetForegroundWindow();
                if (activeWindow == hwnd)
                {
                    for (int i = 0; i < 30; i++)
                    {
                        Thread.Sleep(10);
                        MouseHook.MouseRightClickEvent(0);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void timerL_Tick(object sender, EventArgs e)
        {
            //
            IntPtr hwnd         = FindWindow(null, toolStripTextBoxWinName.Text);
            IntPtr activeWindow = GetForegroundWindow();

            if (activeWindow == hwnd)
            {
                MouseHook.MouseLeftClickEvent(0);
            }
        }
Exemplo n.º 4
0
        private void timerL_Tick(object sender, EventArgs e)
        {
            //
            IntPtr hwnd         = FindWindow(null, toolStripTextBoxWinName.Text);
            IntPtr activeWindow = GetForegroundWindow();

            if (activeWindow == hwnd)
            {
                if (runFlag)
                {
                    keybd_event(Keys.LMenu, 0, 0, 0);
                    MouseHook.MouseLeftClickEvent(0);
                    keybd_event(Keys.LMenu, 0, KEYEVENTF_KEYUP, 0);
                }
            }
            else
            {
                runFlag = false;
                this.ChangeStatus(runFlag);
            }
        }