Handling the WM_GETOBJECT Message

Both Microsoft Active Accessibility and Microsoft UI Automation send the WM_GETOBJECT message to a server or provider application to retrieve information about an accessible object supported by the server or provider. Clients never send WM_GETOBJECT directly. Instead, Microsoft Active Accessibility sends this message when a client calls the AccessibleObjectFromPoint, AccessibleObjectFromEvent, and AccessibleObjectFromWindow functions. UI Automation sends WM_GETOBJECT when a client calls IUIAutomation::ElementFromHandle, ElementFromPoint, and GetFocusedElement, and when handling events for which the client has registered.

Microsoft Active Accessibility or UI Automation specifies the type of object it needs information for by passing a value called an object identifier with the WM_GETOBJECT message. When it receives the message, the server or provider examines the object identifier to determine how to respond to the message. The response depends on whether the receiving application implements Microsoft Active Accessibility (a server), UI Automation (a provider), or neither, for the specified object.

  • If the receiving application is an Microsoft Active Accessibility server and the WM_GETOBJECT message includes an object identifier of OBJID_CLIENT, the server should return the value obtained by passing the IAccessible interface of the object to the LresultFromObject function.
  • If the receiving application is a UI Automation provider and the object identifier is UiaRootObjectId, the provider should return the IRawElementProviderSimple interface of the object. The provider obtains the interface by calling the UiaReturnRawElementProvider function.
  • If the receiving application implements neither Microsoft Active Accessibility nor UI Automation, it should pass the WM_GETOBJECT message to the DefWindowProc function. Passing the message enables the accessibility framework to determine if a proxy is available for the specified object.
  • If the object identifier is neither OBJID_CLIENT nor UiaRootObjectId, the receiving application should pass the WM_GETOBJECT message to the DefWindowProc function. Passing the message enables the accessibility framework to use the default providers for standard UI elements.

Microsoft Active Accessibility and UI Automation can pass custom object identifiers in a WM_GETOBJECT message to retrieve application-defined values or objects from a server or provider. The OBJID_NATIVEOM or OBJID_QUERYCLASSNAMEIDX object identifier can be used to retrieve a native Object Model interface, or to request a specific proxy object that is supported by Oleacc.dll.

By handling both the OBJID_CLIENT and UiaRootObjectId object identifiers, a Microsoft Active Accessibility server implementation can co-exist alongside a UI Automation provider implementation. Because most standard Windows controls and common controls implemented by the common control library (ComCtl32.dll) do not implement either Microsoft Active Accessibility or UI Automation, these controls typically do not handle the WM_GETOBJECT message. Instead, the Microsoft Active Accessibility or UI Automation framework checks if a proxy object is available for a particular UI element. Otherwise, it provides the default proxy object for the host window object.