Expand Minimize

UiaHostProviderFromHwnd function

Gets the host provider for a window.

Syntax


HRESULT WINAPI UiaHostProviderFromHwnd(
  _In_   HWND hwnd,
  _Out_  IRawElementProviderSimple **pProvider
);

Parameters

hwnd [in]

Type: HWND

The window containing the element served by the provider.

pProvider [out]

Type: IRawElementProviderSimple**

The host provider for the window.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The object retrieved by this function is useful only for responding to calls to the IRawElementProviderSimple::get_HostRawElementProvider method. You cannot use the object to raise events, provide properties, and so on. If you need to raise events or provide properties, you must create a provider object that fully implements the IRawElementProviderSimple interface.

Examples

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); 
} 

Requirements

Minimum supported client

Windows XP [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2003 [desktop apps | Windows Store apps]

Header

UIAutomationCoreApi.h

Library

Uiautomationcore.lib

DLL

Uiautomationcore.dll

See also

Functions for Providers

 

 

Community Additions

ADD
Show:
© 2014 Microsoft