Export (0) Print
Expand All

UI Automation Providers Overview

UI Automation providers enable controls to communicate with UI Automation client applications. In general, each control or other distinct element in a user interface is represented by a provider. The provider exposes information about the element and optionally implements control patterns that enable the client application to interact with the control.

Client applications do not usually have to work directly with providers. All the standard controls in applications that use the Microsoft Win32, Windows Forms, or Microsoft Windows Presentation Foundation (WPF) frameworks are automatically exposed to the UI Automation system. Applications that implement custom controls may also implement UI Automation providers for those controls, and client applications do not have to take any special steps to gain access to them.

This topic provides an overview of how control developers implement UI Automation providers.

Types of Providers

UI Automation providers fall into two categories: client-side providers and server-side providers.

Client-side providers are implemented by UI Automation clients to communicate with an application that does not support, or does not fully support, UI Automation. Client-side providers usually communicate with the server across the process boundary by sending and receiving Windows messages.

UI Automation providers for controls in Win32, Windows Forms, or WPF applications are supplied as part of the operating system. Therefore client applications seldom have to implement their own providers.

Server-side providers are implemented by custom controls or by applications that are based on a UI framework that does not natively support UI Automation. Server-side providers communicate with client applications across the process boundary by exposing Component Object Model (COM) interfaces to the UI Automation core system, which in turn serves requests from clients.

UI Automation Provider Concepts

This section provides brief explanations of some of the key concepts you need to understand in order to implement UI Automation providers.

Elements

UI Automation elements are pieces of UI that are visible to UI Automation clients. Examples include application windows, panes, buttons, tooltips, list boxes, and list items.

Navigation

UI Automation elements are exposed to clients as a tree. UI Automation constructs the tree by navigating from one element to another. Navigation is enabled by the providers for each element, each of which may point to a parent, siblings, and first and last children.

For more information on the client view of the tree, see UI Automation Tree Overview.

Views

A client can see the UI Automation tree in three principal views:

Raw viewContains all elements
Control viewContains elements that are controls.
Content viewContains elements that have content.

It is the responsibility of the provider implementation to define an element as a content element or a control element. Control elements may or may not also be content elements, but all content elements are control elements.

Frameworks

A framework is a component that manages child controls, hit-testing, and rendering in an area of the screen. For example, a Win32 window, often referred to as an HWND, can serve as a framework that contains multiple UI Automation elements such as a menu bar, a status bar, and buttons.

Win32 container controls such as list boxes and tree views are considered to be frameworks, because they contain their own code for rendering child items and performing hit-testing on them. By contrast, a WPF list box is not a framework, because the rendering and hit-testing is being handled by the containing window.

The UI in an application can be made up of different frameworks. For example, an HWND application window might contain Dynamic HTML (DHTML) which in turn contains a component such as a combo box in an HWND.

Fragments

A fragment is a complete subtree of elements from a particular framework. The element at the root node of the subtree is called a fragment root. A fragment root does not have a parent, but is hosted within some other framework, usually a Win32 window (HWND).

Hosts

The root node of every fragment must be hosted in an element, usually a Win32 window (HWND). The exception is the desktop, which is not hosted in any other element. The host of a custom control is the HWND of the control itself, not the application window or any other window that might contain groups of top-level controls.

The host of a fragment plays an important role in providing UI Automation services. It enables navigation to the fragment root, and supplies some default properties so that the custom provider does not have to implement them.

Community Additions

Show:
© 2014 Microsoft