IRawElementProviderHwndOverride::GetOverrideProviderForHwnd Method

Gets a UI Automation provider for the specified element.

Syntax

HRESULT GetOverrideProviderForHwnd(      
    HWND hwnd,
    IRawElementProviderSimple **pRetVal
);

Parameters

  • hwnd
    [in] The window handle of the element.
  • pRetVal
    [out, retval] The address of a variable that receives a pointer to the IRawElementProviderSimple interface of the new provider for the specified window, or NULL if the provider is not being overridden. This parameter is passed uninitialized.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

This method is implemented by fragment roots that contain window-based child elements. By default, controls hosted in windows are served by default providers in addition to any custom providers. The default providers treat all windows within a parent window as siblings. If you want to restructure the Microsoft UI Automation tree so that one window-based control is seen as a child of another, you must override the default provider by implementing this method on the fragment root. The returned provider can supply additional properties or override properties of the specified component.

The returned provider must be part of the fragment tree. It can supply additional properties or override properties of the specified component.

If the returned provider implements IRawElementProviderFragment, the provider should be part of the fragment's tree and be reachable by navigating from the fragment's root.

See Also

IRawElementProviderHwndOverride