IUIAutomationProxyFactory::CreateProvider Method

Creates a proxy object that provides Microsoft UI Automation support for a UI element.


HRESULT CreateProvider(      
    UIA_HWND hwnd,
    LONG idObject,
    LONG idChild,
    IRawElementProviderSimple **provider


  • hwnd
    [in] The window handle of the UI element.
  • idObject
    [in] The object ID. See Remarks.
  • idChild
    [in] The child ID. See Remarks.
  • provider
    [out, retval] The address of a variable that receives a pointer to the IRawElementProviderSimple interface of the proxy.

Return Value

Returns S_OK if successful, or an error value otherwise.


The idObject parameter is normally OBJID_CLIENT, and idChild is normally CHILDID_SELF. However, when the method is called in response to a registered WinEvent, these values are from the event, specifying the subelement that raised the event.