Share via


InputInjector Class

Definition

Represents the virtual input device for sending the input data.

public ref class InputInjector sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
class InputInjector final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
public sealed class InputInjector
Public NotInheritable Class InputInjector
Inheritance
Object Platform::Object IInspectable InputInjector
Attributes

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Examples

Here are some downloadable samples demonstrating basic input and input injection:

Remarks

Important

The APIs in this namespace require the inputInjectionBrokered restricted capability.

Using input injection requires the following be added to the Package.appxmanifest:

  • To <Package>
    • xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
    • IgnorableNamespaces="rescap"
  • To <Capabilities>
    • <rescap:Capability Name="inputInjectionBrokered" />

Version history

Windows version SDK version Value added
1709 16299 InitializeGamepadInjection
1709 16299 InjectGamepadInput
1709 16299 TryCreateForAppBroadcastOnly
1709 16299 UninitializeGamepadInjection

Methods

InitializeGamepadInjection()

Initializes a virtual gamepad device that can synthesize input events and provide corresponding input data to the system.

InitializePenInjection(InjectedInputVisualizationMode)

Initializes a virtual pen device that can synthesize input events and provide corresponding input data to the system.

InitializeTouchInjection(InjectedInputVisualizationMode)

Initializes a virtual touch device that can synthesize input events and provide corresponding input data to the system.

InjectGamepadInput(InjectedInputGamepadInfo)

Sends programmatically generated gamepad input to the system.

InjectKeyboardInput(IIterable<InjectedInputKeyboardInfo>)

Sends programmatically generated keyboard input to the system.

InjectMouseInput(IIterable<InjectedInputMouseInfo>)

Sends programmatically generated mouse input to the system.

InjectPenInput(InjectedInputPenInfo)

Sends programmatically generated pen input to the system.

Note

The APIs in this namespace require the inputInjectionBrokered restricted capability.

InjectShortcut(InjectedInputShortcut)

Sends programmatically generated system shortcuts to the system.

InjectTouchInput(IIterable<InjectedInputTouchInfo>)

Sends programmatically generated touch input to the system.

TryCreate()

Attempts to create a new instance of the InputInjector class.

Note

The APIs in this namespace require the inputInjectionBrokered restricted capability.

TryCreateForAppBroadcastOnly()

Attempts to create a new instance of the InputInjector class.

UninitializeGamepadInjection()

Shuts down the virtual gamepad device created with InitializeGamepadInjection.

UninitializePenInjection()

Shuts down the virtual pen device created with InitializePenInjection.

UninitializeTouchInjection()

Shuts down the virtual touch device created with InitializeTouchInjection.

Note

The APIs in this namespace require the inputInjectionBrokered restricted capability.

Applies to

See also