c:\Windows\system32\user32.dll
DllImport
отвечает using System.Runtime.InteropServices;
System.Runtime.InteropServices.dll
c:\Windows\assembly\NativeImages_v4.0.30319_32\System.Runt9e372c89#\3a9d576029ef8412e4347e3bdb6c25b6\System.Runtime.InteropServices.ni.dll
c:\Windows\assembly\NativeImages_v4.0.30319_32\System.Runtbff93e24#\254e0257430adab0e435bb06dd76f38b\System.Runtime.InteropServices.WindowsRuntime.ni.dll
c:\Windows\assembly\NativeImages_v4.0.30319_64\System.Runt9e372c89#\89f8611d3779503ee5c7d40da8424a56\System.Runtime.InteropServices.ni.dll
c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.InteropServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.dll
c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_40.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll
c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.InteropServices.dll
c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.InteropServices.WindowsRuntime.dll
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Runtime.InteropServices.dll
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Runtime.InteropServices.WindowsRuntime.dll
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
[DllImport("user32.dll")]
static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
private const int MOUSEEVENTF_MOVE = 0x0001;
private const int MOUSEEVENTF_LEFTDOWN = 0x0002;
private const int MOUSEEVENTF_LEFTUP = 0x0004;
private const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
private const int MOUSEEVENTF_RIGHTUP = 0x0010;
private const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
private const int MOUSEEVENTF_MIDDLEUP = 0x0040;
private const int MOUSEEVENTF_ABSOLUTE = 0x8000;
// positive values indicate movement right, down
public static void Move(int xDelta, int yDelta) {
mouse_event(MOUSEEVENTF_MOVE, xDelta, yDelta, 0, 0);
public static void LeftClick() {
mouse_event(MOUSEEVENTF_LEFTDOWN, Control.MousePosition.X, Control.MousePosition.Y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, Control.MousePosition.X, Control.MousePosition.Y, 0, 0);
}