AddElementSegment method

Creates an IElementSegment interface for an element in a markup container and adds the segment to the editable selection.


HRESULT retVal = object.AddElementSegment(pIElement, ppISegmentAdded);


  • pIElement [in]
    Type: [IHTMLElement](aa752279(v=vs.85).md)

    Pointer to an IHTMLElement interface that specifies the element to add to the selection.

  • ppISegmentAdded [out]
    Type: [IElementSegment](aa703909(v=vs.85).md)

    Address of a pointer to a variable that receives an IElementSegment interface pointer for the element segment added to the selection environment.

Return value


If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


The selection type (set with the ISelectionServices::SetSelectionType method) must be set to SELECTION_TYPE_Control before a call to ISelectionServices::AddElementSegment.