Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets the host provider for a window.
Syntax
HRESULT UiaHostProviderFromHwnd(
[in] HWND hwnd,
[out] IRawElementProviderSimple **ppProvider
);
Parameters
[in] hwnd
Type: HWND
The window containing the element served by the provider.
[out] ppProvider
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
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | uiautomationcoreapi.h |
Library | Uiautomationcore.lib |
DLL | Uiautomationcore.dll |