Exemple #1
0
        private void WorkerStart()
        {
            if (!started)
            {
                try
                {
                    x = Convert.ToInt32(this.txt_mx.Text.Trim());
                    y = Convert.ToInt32(this.txt_my.Text.Trim());

                    clickType = this.cmb_mpress.SelectedIndex;
                    action    = this.cmb_maction.SelectedIndex;

                    double hours        = (double)this.numericHour.Value * 60 * 60 * 1000;
                    double minute       = (double)this.numericMill.Value * 60 * 1000;
                    double second0      = (double)this.numericSecond.Value * 1000;
                    double second1      = (double)this.numericSecond1.Value * 100;
                    double second2      = (double)this.numericSecond2.Value * 10;
                    double seperateTime = hours + minute + second0 + second1 + second2;

                    timer.Interval = seperateTime;

                    MouseEventHelper.MouseEventAbs(OperatingFlag.MouseEvent_Move, x, y);
                    timer.Start();
                    ChanageState(true);
                }
                catch
                {
                    MessageBox.Show(this, "输入的参数非法", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Exemple #2
0
        public MainForm()
        {
            InitializeComponent();
            SubscribeGlobal();

            timer           = new System.Timers.Timer();
            timer.AutoReset = true;
            timer.Elapsed  += new System.Timers.ElapsedEventHandler(Timer_Worker);

            MouseEventHelper.MouseEvent(OperatingFlag.MouseEvent_Move, 0, 0);
            this.cmb_mpress.SelectedIndex  = 0;
            this.cmb_maction.SelectedIndex = 0;
            this.lbl_version.Text          = string.Format("v{0}", CurrentVersion);

            BindFastKeys("start", txt_start.Text.Trim());
            BindFastKeys("stop", txt_stop.Text.Trim());

            ThreadPool.QueueUserWorkItem(CheckUpdate, CurrentVersion);
        }
Exemple #3
0
        private void Timer_Worker(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (started)
            {
                try
                {
                    //这里是鼠标左键按下和松开两个事件的组合即一次单击
                    //mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

                    //模拟鼠标右键单击事件
                    //mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);

                    //两次连续的鼠标左键单击事件 构成一次鼠标双击事件:
                    //mouse_event (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 )
                    //mouse_event (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 )

                    switch (clickType)
                    {
                    case 0:
                        MouseEventHelper.MouseEventAbs(OperatingFlag.MouseEvent_LeftDown | OperatingFlag.MouseEvent_LeftUp, x, y, action + 1);
                        break;

                    case 1:
                        MouseEventHelper.MouseEventAbs(OperatingFlag.MouseEvent_RightDown | OperatingFlag.MouseEvent_RightUp, x, y, action + 1);
                        break;

                    case 2:
                        MouseEventHelper.MouseEventAbs(OperatingFlag.MouseEvent_MiddleDown | OperatingFlag.MouseEvent_MiddleUp, x, y, action + 1);
                        break;

                    default:
                        break;
                    }
                }
                catch
                {
                    ChanageState(false);
                    //MessageBox.Show(this, "输入的参数非法", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }