ITextRange::SetIndex method (tom.h)
Changes this range to the specified unit of the story.
Syntax
HRESULT SetIndex(
[in] long Unit,
[in] long Index,
[in] long Extend
);
Parameters
[in] Unit
Type: long
Unit used to index the range. For a list of unit values, see ITextRange.
[in] Index
Type: long
Index for the Unit. This range is relocated to the Unit that has this index number. If positive, the numbering of Units begins at the start of the story and proceeds forward. If negative, the numbering begins at the end of the story and proceeds backward. The start of the story corresponds to an Index of 1 for all units that exist, and the last unit in the story corresponds to an Index of -1.
[in] Extend
Type: long
Flag that indicates the extent of the range. If zero (the default), the range is collapsed to an insertion point at the start position of the specified Unit. If nonzero, the range is set to the entire Unit.
Return value
Type: HRESULT
The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more information about COM error codes, see Error Handling in COM.
Return code | Description |
---|---|
|
Index is not valid. |
|
Unit is not supported. |
|
Failure for some other reason. |
Remarks
This method allows an application to work with line-oriented text, such as programs, in a convenient way. For example, SetIndex(tomLine, 10, 0)
converts a range to an insertion point at the start of the tenth line.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | tom.h |
DLL | Msftedit.dll |
See also
Conceptual
Reference