IUIAutomationTextRange::MoveEndpointByRange Method

Moves one endpoint of a text range to the specified endpoint of a second text range.

Syntax

HRESULT MoveEndpointByRange(      
    TextPatternRangeEndpoint srcEndPoint,
    IUIAutomationTextRange *range,
    TextPatternRangeEndpoint targetEndPoint
);

Parameters

  • srcEndPoint
    [in] A value from the TextPatternRangeEndpointEnum enumerated type specifying the endpoint (either start or end) to move.
  • range
    [in] A pointer the IUIAutomationTextRange interface for another range from the same text provider.
  • targetEndPoint
    [in] A value from the TextPatternRangeEndpointEnum enumerated type specifying the destination endpoint (either start or end).

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

If the endpoint being moved crosses the other endpoint of the same text range, that other endpoint is moved also, resulting in a degenerate (empty) range and ensuring the correct ordering of the endpoints (that is, the start is always less than or equal to the end).