ObjectModel Control Pattern

Describes guidelines and conventions for implementing IObjectModelProvider, including information about methods. The ObjectModel control pattern is used to expose a pointer to the underlying object model of a document.

Many applications implement rich object models that add value beyond what Microsoft UI Automation provides. This control pattern allows a client to navigate from a UI Automation element into the underlying object model.

This topic contains the following sections.

Implementation Guidelines and Conventions

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

  • The IObjectModelProvider::GetUnderlyingObjectModel method should return a pointer to the object that is as close as possible to the source UI element. For example, in a web browser, a UI Automation provider for a single element should return an object model pointer for the element. Returning an object model pointer for the document root would be far less useful.
  • The client of the ObjectModel control pattern is expected to have the IID for the interface they are seeking, which is why it is enough to return a simple IUnknown pointer.
  • Because UI Automation marshals the pointer to the client process, the provider should expect the client to access the object model using standard Component Object Model (COM) practices.

Required Members for IObjectModelProvider

The following method is required for implementing the IObjectModelProvider interface.

Required members Member type Notes
GetUnderlyingObjectModel Method Returns a COM pointer to the underlying object model. The client is expected to call the IUnknown::QueryInterface method to retrieve specific object model pointers.

 

This control pattern has no associated events.

Control Types and Their Supported Control Patterns

UI Automation Control Patterns Overview

UI Automation Tree Overview