Пример #1
0
        private void HandleKeyDownHookEvent(MouseHookEventArgs args)
        {
            OnHook?.Invoke(args);

            lock (downButtons)
            {
                // Save button to recognize successfull key presses (down and up)
                bool added = downButtons.Add(args.Button);

                if (added)
                {
                    OnHold?.Invoke(args);
                }
            }
        }
Пример #2
0
        private void HandleKeyReleasedHookEvent(MouseHookEventArgs args)
        {
            OnHook?.Invoke(args);

            lock (downButtons)
            {
                bool removed = downButtons.Remove(args.Button);

                OnRelease?.Invoke(args);

                if (removed)
                {
                    OnClick?.Invoke(args);
                }
            }
        }
Пример #3
0
 private void OnLocalMouseMove(MouseHookEventArgs args)
 {
     label4.Text = string.Format("Window mouse coords: {0}, {1}", args.X, args.Y);
 }
Пример #4
0
 private void OnGlobalMouseMove(MouseHookEventArgs args)
 {
     label2.Text = string.Format("Current mouse coords: {0}, {1}", args.X, args.Y);
     label3.Text = string.Format("Absolute mouse coords: {0}, {1}", Sender.AbsoluteX(args.X), Sender.AbsoluteY(args.Y));
 }