Implementing the UI Automation SynchronizedInput Control Pattern

This topic introduces guidelines and conventions for implementing ISynchronizedInputProvider, including information about properties and methods. Links to additional references are listed at the end of the topic.

The SynchronizedInput control pattern enables Microsoft UI Automation client applications to direct the mouse or keyboard input to a specific UI element. This control pattern is typically used in automated test scripts to send mouse or keyboard input to a specific user-interface element, and then verify that the element received the input.

This topic contains the following sections.

  • Implementation Guidelines and Conventions
  • Required Members for ISynchronizedInputProvider
  • Related Topics

Implementation Guidelines and Conventions

When implementing the SynchronizedInput control pattern, note the following guidelines and conventions:

  • When the ISynchronizedInputProvider::StartListening method is called, the UI Automation provider should start checking for input of the specified type, and then take one of the following actions:

    • When matching input is found for the element, the provider should raise the UIA_InputReachedTargetEventId event.
    • When matching input is found, but it reached a different element, the provider should raise the UIA_InputReachedOtherElementEventId event.
    • When mismatched input is found, the provider should discard the input and raise the UIA_InputDiscardedEventId event.
  • The UI Automation provider must discard the input if it is for an element other than the current element.

  • When the element receives the input, or when the ISynchronizedInputProvider::Cancel method is called, the provider stops checking input and continues as normal.

  • If StartListening is called when the provider is already listening for input, the provider should return UIA_E_INVALIDOPERATION.

Required Members for ISynchronizedInputProvider

The following properties, methods, and events are required for implementing the ISynchronizedInputProvider interface.

Required members Member type Notes
ISynchronizedInputProvider::StartListening Method None
ISynchronizedInputProvider::Cancel Method None
UIA_InputReachedTargeEventId Event None