Compartilhar via


Implementação de Provedor de Automação de Interface de Usuário do Lado do Cliente

Observação

Esta documentação destina.Os desenvolvedores do NET Framework que desejam usar o gerenciado UI Automation classes definidas na System.Windows.Automation namespace.As informações mais recentes sobre UI Automation, consulte API de automação do Windows: Automação da interface do usuário.

Diversos diferente user interface (UI) estruturas estão em uso dentro de Microsoft sistemas operacionais, incluindo Win32, Windows Forms, e Windows Presentation Foundation (WPF). Microsoft UI Automationexpõe as informações sobre os elementos de interface do usuário para clientes. However, UI Automation does not itself have awareness of the different types of controls that exist in these frameworks and the techniques that are needed to extract information from them. Instead, it leaves this task to objects called providers. A provider extracts information from a specific control and hands that information to UI Automation, which then presents it to the client in a consistent manner.

Providers can exist either on the server side or on the client side. Um provedor do lado do servidor é implementado pelo próprio controle. WPFelementos implementam provedores, assim como os controles de terceiros escritos com UI Automation em mente.

However, older controls such as those in Win32 and Windows Forms do not directly support UI Automation. These controls are served instead by providers that exist in the client process and obtain information about controls using cross-process communication; for example, by monitoring windows messages to and from the controls. Such client-side providers are sometimes called proxies.

Windows Vista supplies providers for standard Win32 and Windows Forms controls. In addition, a fallback provider gives partial UI Automation support to any control that is not served by another server-side provider or proxy but has a Microsoft Active Accessibility implementation. All these providers are automatically loaded and available to client applications.

For more information on support for Win32 and Windows Forms controls, see Suporte a automação de interface do usuário para Controles Padrão.

Applications can also register other client-side providers.

Este tópico contém as seguintes seções.

  • Distributing Client-Side Providers
  • Registering and Configuring Client-Side Providers
  • Tópicos relacionados

Distributing Client-Side Providers

UI Automation expects to find client-side providers in a managed-code assembly. The namespace in this assembly should have the same name as the assembly. For example, an assembly called ContosoProxies.dll would contain the ContosoProxies namespace. Within the namespace, create a UIAutomationClientSideProviders class. In the implementation of the static ClientSideProviderDescriptionTable field, create an array of ClientSideProviderDescription structures describing the providers.

Registering and Configuring Client-Side Providers

Client-side providers in a dynamic-link library (DLL) are loaded by calling RegisterClientSideProviderAssembly. No further action is required by a client application to make use of the providers.

Providers implemented in the client's own code are registered by using RegisterClientSideProviders. This method takes as an argument an array of ClientSideProviderDescription structures, each of which specifies the following properties:

  • A callback function that creates the provider object.

  • The class name of the controls that the provider will serve.

  • The image name of the application (usually the full name of the executable file) that the provider will serve.

  • Flags that govern how the class name is matched against window classes found in the target application.

The last two parameters are optional. The client might specify the image name of the target application when it wants to use different providers for different applications. For example, the client might use one provider for a Win32 list view control in a known application that supports the Multiple View pattern, and another for a similar control in another known application that does not.

Consulte também

Tarefas

Criar um Provedor de Automação de Interface de Usuário do Lado do Cliente

Implement UI Automation Providers in a Client Application