CTextRange2.InRangemethod
Determines whether this range is within or at the same text as a specified range.
Syntax
FUNCTION InRange (BYVAL pRange AS ITextRange2 PTR) AS LONG
Parameters
| Name | Description | |
|---|---|---|
pRange | Text that is compared to the current range. |
Return value
The comparison result. The pointer can be null. The method returns tomTrue only if the range is in or at the same text as pRange.
Description
Determines whether this range is within or at the same text as a specified range.
Remarks
For range2 to be contained in range1, both ranges must be in the same story, and the limits of range2 must satisfy either of the following statements.
- The start and end character positions of range1 are the same as range2. That is, both ranges are degenerate and have identical insertion points.
- Range2 is a nondegenerate range with start and end character positions at or within those of range1.
The following example shows how to walk one range with another.
When the FindText, MoveWhile, and MoveUntil method families are used, you can use one range to walk another by specifying the appropriate limit count of characters (for an example, see the Remarks in Find).
IsEqual is a special case of InRange that returns tomTrue if the pRange has the same start and end character positions and belongs to the same story.
Example
range2 = range1.GetDuplicate range2.SetEnd = range2.SetStart ' Collapse range2 to its start position While range2.InRange(range1) ' Iterate so long as range2 remains within range1 ... ' This code would change the range2 character positions Wend
Reference
- Defined in AfxNova/CTextRange2.inc:426
- Documented in Windows/WIndows Controls/RichEdit/CTextRange2 Class.md
- Topic: CTextRange2 Class