From d73db7d0b446cea71a244da196aeb69b3f7cd0d2 Mon Sep 17 00:00:00 2001 From: Lev Rusanov <30170278+JDM170@users.noreply.github.com> Date: Thu, 29 May 2025 12:20:48 +0700 Subject: [PATCH] Update Program.cs Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com> --- Program.cs | 48 ++---------------------------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/Program.cs b/Program.cs index 79bf01e..2fb769c 100644 --- a/Program.cs +++ b/Program.cs @@ -8,9 +8,6 @@ namespace MouseSimulator public class MouseSimulator { // Импорт необходимых функций из user32.dll - //[DllImport("user32.dll")] - //private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, int dwExtraInfo); - [DllImport("user32.dll")] private static extern bool GetCursorPos(out POINT lpPoint); @@ -24,20 +21,6 @@ namespace MouseSimulator public int Y; } - // Константы для mouse_event - /* - private const uint MOUSEEVENTF_LEFTDOWN = 0x0002; - private const uint MOUSEEVENTF_LEFTUP = 0x0004; - private const uint MOUSEEVENTF_RIGHTDOWN = 0x0008; - private const uint MOUSEEVENTF_RIGHTUP = 0x0010; - private const uint MOUSEEVENTF_MIDDLEDOWN = 0x0020; - private const uint MOUSEEVENTF_MIDDLEUP = 0x0040; - private const uint MOUSEEVENTF_WHEEL = 0x0800; - private const uint MOUSEEVENTF_HWHEEL = 0x01000; - private const uint MOUSEEVENTF_MOVE = 0x0001; - private const uint MOUSEEVENTF_ABSOLUTE = 0x8000; - */ - // Перемещение курсора public static void MoveTo(int x, int y) { @@ -47,37 +30,10 @@ namespace MouseSimulator // Поулчение позиции курсора public static POINT GetPosition() { - POINT point; - if (GetCursorPos(out point)) + if (GetCursorPos(out POINT point)) return point; return default; } - - /* - // Левый клик - public static void LeftClick() - { - mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); - } - - // Правый клик - public static void RightClick() - { - mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); - } - - // Прокрутка колеса - public static void MouseWheel(int delta) - { - mouse_event(MOUSEEVENTF_WHEEL, 0, 0, (uint)delta, 0); - } - - // Горизонтальная прокрутка - public static void MouseHWheel(int delta) - { - mouse_event(MOUSEEVENTF_HWHEEL, 0, 0, (uint)delta, 0); - } - */ } internal class Program @@ -91,7 +47,7 @@ namespace MouseSimulator int stepToMove = 1; int[][] steps = { - // x y + // x y new int[] { 0, -stepToMove }, new int[] { 0, stepToMove }, new int[] { stepToMove, 0 },