如果我知道X和Y坐标,是否有Windows API或.NET中的某种技术可以使鼠标指针移动到该点?我知道肯定有这样的东西,因为有些工具似乎可以跳过鼠标。但我不知道这些API在.NET中是否容易访问。有吗?请假定WPF、.Net和Windows(当然)。
public Window1()
{
InitializeComponent();
NativeMethods.SetCursorPos(300, 300);
}
public partial class NativeMethods
{
[System.Runtime.InteropServices.DllImportAttribute("user32.dll",
EntryPoint = "SetCursorPos")]
[return: System.Runtime.InteropServices.MarshalAsAttribute
(System.Runtime.InteropServices.UnmanagedType.Bool)]
public static extern bool SetCursorPos(int X, int Y);
}