private static void SendMouseEvent(uint type) { var input = new Win32.INPUT { type = Win32.INPUT_MOUSE, mi = new Win32.MOUSEINPUT { dx = 0, dy = 0, mouseData = 0, time = 0, dwExtraInfo = IntPtr.Zero, dwFlags = type } }; Win32.SendInput(1, ref input, Marshal.SizeOf(input)); }