The INPUT structure is used by SendInput to store information for synthesizing input events such as keystrokes, mouse movement, and mouse clicks. (see: http://msdn.microsoft.com/en-us/library/ms646270(VS.85).aspx) Declared in Winuser.h, include Windows.h
This structure contains information identical to that used in the parameter list of the keybd_event or mouse_event function. Windows 2000/XP: INPUT_KEYBOARD supports nonkeyboard input methods, such as handwriting recognition or voice recognition, as if it were text input by using the KEYEVENTF_UNICODE flag. For more information, see the remarks section of KEYBDINPUT.
 public void DispatchInput(InputEntry[] inputs) {
     if (inputs == null) throw new ArgumentNullException(nameof(inputs));
     if (inputs.Length == 0) throw new ArgumentException(@"The input array was empty", nameof(inputs));
     var successful = NativeMethods.SendInput((uint)inputs.Length, inputs, Marshal.SizeOf(typeof(InputEntry)));
     if (successful != inputs.Length) {
         throw new Exception(
                 "Some simulated input commands were not sent successfully. The most common reason for this happening are the security features of Windows including User Interface Privacy Isolation (UIPI). Your application can only send commands to applications of the same or lower elevation. Similarly certain commands are restricted to Accessibility/UIAutomation applications. Refer to the project home page and the code samples for more information.");
     }
 }
Exemple #2
0
 private void SendSimulatedInput(InputEntry[] inputList) {
     _messageDispatcher.DispatchInput(inputList);
 }
Exemple #3
0
 public static extern uint SendInput(uint numberOfInputs, InputEntry[] inputs, int sizeOfInputStructure);