/// <summary> /// Sends the list of <see cref="INPUT"/> messages using the <see cref="IInputMessageDispatcher"/> instance. /// </summary> /// <param name="inputList">The <see cref="System.Array"/> of <see cref="INPUT"/> messages to send.</param> /// <returns>The number of successful messages that were sent.</returns> private int SendSimulatedInput(INPUT[] inputList) { if (inputList == null || inputList.Length == 0) return -1; return (int)_messageDispatcher.DispatchInput(inputList); }
internal static extern UInt32 SendInput(UInt32 numberOfInputs, INPUT[] inputs, Int32 sizeOfInputStructure);
/// <summary> /// Dispatches the specified list of <see cref="INPUT"/> messages in their specified order by issuing a single called to <see cref="NativeMethods.SendInput"/>. /// </summary> /// <param name="inputs">The list of <see cref="INPUT"/> messages to be dispatched.</param> /// <returns> /// The number of <see cref="INPUT"/> messages that were successfully dispatched. /// </returns> public UInt32 DispatchInput(INPUT[] inputs) { return User32API.SendInput((UInt32)inputs.Count(), inputs.ToArray(), Marshal.SizeOf(typeof(INPUT))); }