Пример #1
0
 private void btn_Record_Click(object sender, EventArgs e)
 {
     clickPoints.Clear();
     StaticMouseHook.hook();
     StaticMouseHook.SetMouseDelegate(mousehookEvent);
     mouseRecording = true;
 }
Пример #2
0
        public clickForm()
        {
            InitializeComponent();

            lbl_btn.Text             = KeyboardHook.VKeys.F6.ToString();
            lbl_Recording_Start.Text = KeyboardHook.VKeys.DOWN.ToString();
            clickMouse     = KeyboardHook.VKeys.F6;
            startRecording = KeyboardHook.VKeys.DOWN;
            clickPoints    = new List <Point>();

            StaticMouseHook.SetMouseDelegate(mousehookEvent);
            StaticMouseHook.SetMouseDelegate(mousehookEventFastClick);
            //TODO maak deze classe niet private

            WindowState = FormWindowState.Minimized;
            kbhook      = new KeyboardHook();
            kbhook.Install();
            kbhook.KeyDown += KbhookOnKeyDown;
        }
Пример #3
0
        private void KbhookOnKeyDown(KeyboardHook.VKeys key)
        {
            //TODO Clean dit op
            if (expectInput)
            {
                clickMouse   = key;
                lbl_btn.Text = key.ToString();
                expectInput  = false;
            }
            if (mouseRecording)
            {
                if (key == KeyboardHook.VKeys.ESCAPE)
                {
                    StaticMouseHook.RemoveMouseDelegate(mousehookEvent);
                    mouseRecording = false;
                }
            }
            if (setPlayButton)
            {
                startRecording           = key;
                lbl_Recording_Start.Text = key.ToString();
                setPlayButton            = false;
            }

            if (key == startRecording)
            {
                if (!playing)
                {
                    playRecording();
                }
            }

            if (key == clickMouse)
            {
                if (cb_Alt.Checked)
                {
                    PressKey(Keys.Alt);
                }

                if (cb_Shift.Checked)
                {
                    PressKey(Keys.ShiftKey);
                }

                if (cb_Ctrl.Checked)
                {
                    PressKey(Keys.ControlKey);
                }

                for (var i = 0; i < nud_Clicks.Value; i++)
                {
                    DoMouseClick();
                }

                if (cb_Alt.Checked)
                {
                    ReleaseKey(Keys.Alt);
                }

                if (cb_Shift.Checked)
                {
                    ReleaseKey(Keys.ShiftKey);
                }

                if (cb_Ctrl.Checked)
                {
                    ReleaseKey(Keys.ControlKey);
                }
            }
        }
Пример #4
0
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     kbhook.Uninstall();
     StaticMouseHook.unhook();
     base.OnFormClosing(e);
 }