ITextRange::EndOf method (tom.h)
Moves this range's ends to the end of the last overlapping Unit in the range.
HRESULT EndOf( long Unit, long Extend, long *pDelta );
Unit to use. Default value: tomWord. For a list of the other Unit values, see the discussion under ITextRange.
Indicator of how the shifting of the range ends is to proceed. It can be one of the following.
|0 or tomMove||Collapses a nondegenerate range to the End of the original range by moving the insertion point. This is the default.|
|1 (or tomExtend)||Moves End to the end of the overlapping Unit. Does not move Start.|
The count of characters that End is moved past. The value of the pointer can be null. On return, the value of pDelta is the number of characters the insertion point or End is moved plus 1 if a collapse occurs to the entry End. If the range includes the final CR (carriage return) (at the end of the story) and Extend = tomMove, then pDelta is set to –1, to indicate that the collapse occurred before the end of the range (because an insertion point cannot exist beyond the final CR).
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.
||Unit is not supported.|
||Failure for some other reason.|
For comparison, the ITextRange::StartOf method moves the range ends to the beginning of the first overlapping Unit in the range. Note, the ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in that the latter extend from the active end, whereas ITextRange::StartOf extends from Start and ITextRange::EndOf extends from End. If the range is an insertion point on a boundary between Units, ITextRange::EndOf does not change End. In particular, calling ITextRange::EndOf (tomCharacter, *, *) does not change End except for an insertion point at the beginning of a story.
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|