Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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

 

 

Show:
© 2017 Microsoft