Share via


IRawElementProviderSimple::HostRawElementProvider Property

Gets a base provider for this element.

Syntax

HRESULT IRawElementProviderSimple::get_HostRawElementProvider(IRawElementProviderSimple **pRetVal);

Parameters

  • pRetVal
    The address of a variable that receives a pointer to the IRawElementProviderSimple interface of the host provider. This parameter is passed uninitialized.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

This property is generally the UI Automation provider for the window of a custom control. Microsoft UI Automation uses this provider in combination with the custom provider. For example, the runtime identifier of the element is usually obtained from the host provider.

A host provider must be returned in the following cases: when the element is a fragment root, when the element is a simple element (such as a push button), and when the provider is a repositioning placeholder. In other cases, the property should be NULL.

Example

The following example returns the host provider for the window that hosts the control served by this provider.

HRESULT STDMETHODCALLTYPE Provider::get_HostRawElementProvider(IRawElementProviderSimple** pRetVal)
{
    return UiaHostProviderFromHwnd(controlHWnd, pRetVal); 
}
            

See Also

IRawElementProviderSimple