IUIAutomation::ElementFromPoint Method

Retrieves the IUIAutomationElement interface for the UI element at the specified point on the desktop.

Syntax

HRESULT ElementFromPoint(      
    POINT pt,
    IUIAutomationElement **element
);

Parameters

  • pt
    [in] A POINT structure that specifies the desktop coordinates of the UI element.
  • element
    [out, retval] The address of a variable that receives a pointer to the IUIAutomationElement interface.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The IUIAutomation::ElementFromPoint method returns the UIA_E_ELEMENTNOTAVAILABLE error code if the element under the point is already removed by the time the method returns. Clients should handle errors from this method gracefully; for example, by trying the call again.

See Also

IUIAutomation::ElementFromPointBuildCache