Skip to content

Latest commit

 

History

History
112 lines (72 loc) · 3.56 KB

nf-tom-itextrange-setstart.md

File metadata and controls

112 lines (72 loc) · 3.56 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:tom.ITextRange.SetStart
ITextRange::SetStart (tom.h)
Sets the character position for the start of this range.
ITextRange interface [Windows Controls]
SetStart method
ITextRange.SetStart
ITextRange::SetStart
SetStart
SetStart method [Windows Controls]
SetStart method [Windows Controls]
ITextRange interface
_win32_ITextRange_SetStart
_win32_ITextRange_SetStart_cpp
controls.ITextRange_SetStart
controls._win32_ITextRange_SetStart
tom/ITextRange::SetStart
controls\ITextRange_SetStart.htm
Controls
VS|Controls|~\controls\richedit\textobjectmodel\textobjectmodelreference\textobjectmodelinterfaces\setstart.htm
12/05/2018
ITextRange interface [Windows Controls],SetStart method, ITextRange.SetStart, ITextRange::SetStart, SetStart, SetStart method [Windows Controls], SetStart method [Windows Controls],ITextRange interface, _win32_ITextRange_SetStart, _win32_ITextRange_SetStart_cpp, controls.ITextRange_SetStart, controls._win32_ITextRange_SetStart, tom/ITextRange::SetStart
tom.h
Windows
Windows Vista [desktop apps only]
Windows Server 2003 [desktop apps only]
Msftedit.dll
Windows
19H1
ITextRange::SetStart
tom/ITextRange::SetStart
c++
APIRef
kbSyntax
COM
Msftedit.dll
ITextRange.SetStart

ITextRange::SetStart

-description

Sets the character position for the start of this range.

-parameters

-param cpFirst [in]

Type: long

The new character position for the start of the range.

-returns

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

Note that if cpFirst is greater than the range's end position, this method sets the end position equal to cpFirst, making the range an insertion point. If this range is the selection, the start position becomes the active end and is scrolled into view if the display isn't frozen.

ITextRange::SetEnd sets the range's end position, and ITextRange::SetRange sets both range ends simultaneously. The following example shows how to convert a nondegenerate range into a degenerate one (insertion point).

range.End = range.Start

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

The following example adds 1 to the end position, if it is not at the end of the story.

range.End = range.End + 1

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

-see-also

Conceptual

GetStart

ITextRange

Reference

SetEnd

SetRange

Text Object Model