示例#1
0
 /// <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");
     }
 }
示例#2
0
 /// <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});
 }
示例#3
0
 public static extern int SendInput(int nInputs, Input[] pInputs, int cbSize);