Skip to content

Commit d1e91c7

Browse files
authored
Merge pull request arkane-systems#3 from sbennett1990/master
Calculate size of INPUT instead of hard coding value
2 parents a5f62b5 + 390aace commit d1e91c7

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Jiggler.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ public static class Jiggler
3131

3232
public static void Jiggle (int dx, int dy)
3333
{
34-
var inp = new INPUT ();
35-
inp.TYPE = Jiggler.INPUT_MOUSE;
36-
inp.dx = dx;
37-
inp.dy = dy;
38-
inp.mouseData = 0;
39-
inp.dwFlags = Jiggler.MOUSEEVENTF_MOVE;
40-
inp.time = 0;
41-
inp.dwExtraInfo = (IntPtr) 0;
42-
43-
if (SendInput (1, ref inp, 28) != 1)
34+
var inp = new INPUT
35+
{
36+
TYPE = Jiggler.INPUT_MOUSE,
37+
dx = dx,
38+
dy = dy,
39+
mouseData = 0,
40+
dwFlags = Jiggler.MOUSEEVENTF_MOVE,
41+
time = 0,
42+
dwExtraInfo = (IntPtr) 0
43+
};
44+
45+
if (SendInput (1, ref inp, Marshal.SizeOf (inp)) != 1)
4446
throw new Win32Exception ();
4547
}
4648
}

0 commit comments

Comments
 (0)