/// <summary> /// Synthesizes keystrokes, mouse motions, and button clicks. /// </summary> /// <param name="inputs"> /// An array of <see cref="Input" /> structures. Each structure represents an event to be inserted /// into the keyboard or mouse input stream. /// </param> public static void SendInput(Input[] inputs) { // Check if the array passed in parameter is not empty if (inputs != null && inputs.Length != 0) { if (NativeMethods.SendInput(inputs.Length, inputs, MarshalType<Input>.Size) == 0) { throw new Win32Exception("Couldn't send the inputs."); } } else { throw new ArgumentException("The parameter cannot be null or empty.", "inputs"); } }
/// <summary> /// Synthesizes keystrokes, mouse motions, and button clicks. /// </summary> /// <param name="input">A structure represents an event to be inserted into the keyboard or mouse input stream.</param> public static void SendInput(Input input) { SendInput(new[] {input}); }
public static extern int SendInput(int nInputs, Input[] pInputs, int cbSize);