ITextRange::SetEnd method

Sets the end position of the range.

Syntax


HRESULT SetEnd(
  long cp
);

Parameters

cp

Type: long

The new end position.

Return value

Type: HRESULT

The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns S_FALSE.

Remarks

If the new end position is less than the start position, this method also sets the start position to cp; that is, the range becomes an insertion point.

If this range is actually the selection, the end position becomes the active end and, if the display is not frozen, it is scrolled into view.

ITextRange::SetStart sets the range's start position and ITextRange::SetRange sets both range ends simultaneously. To convert a nondegenerate range, r, into a degenerate one (insertion point) at the start position, use

r.End = r.Start

Similarly, r.Start = r.End converts r into an insertion point at the end position.

To add 1 to the end position, unless it is at the end of the story, use:

r.End = r.End + 1

This also makes end position the active end, and it can turn a degenerate range into a nondegenerate one.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Tom.h

DLL

Msftedit.dll

See also

Reference
ITextRange
GetEnd
SetRange
SetStart
Conceptual
Text Object Model

 

 

Community Additions

ADD
Show:
© 2014 Microsoft