ITfRange::CompareStart method (msctf.h)

The ITfRange::CompareStart method compares the start anchor position of this range of text to an anchor in another range.

Syntax

HRESULT CompareStart(
  [in]  TfEditCookie ec,
  [in]  ITfRange     *pWith,
  [in]  TfAnchor     aPos,
  [out] LONG         *plResult
);

Parameters

[in] ec

Edit cookie obtained from ITfDocumentMgr::CreateContext or ITfEditSession::DoEditSession.

[in] pWith

Pointer to a specified range in which an anchor is to be compared to this range start anchor.

[in] aPos

Enumeration element that indicates which anchor of the specified pWith range to compare to this range start anchor.

Value Meaning
TF_ANCHOR_START
Compare this range start anchor with the specified range start anchor.
TF_ANCHOR_END
Compare this range start anchor with the specified range end anchor.

[out] plResult

Pointer to the result of the comparison between this range start anchor and the specified pWith range anchor.

Value Meaning
-1
This start anchor is behind the anchor of the specified range (position of this start anchor < position of the anchor of the specified range).
0
This start anchor is at the same position as the anchor of the specified range.
+1
This start anchor is ahead of the anchor of the specified range (position of this start anchor > position of the anchor of the specified range).

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
E_FAIL
An unspecified error occurred.
E_INVALIDARG
One or more parameters are invalid.
TF_E_NOLOCK
The value of the ec parameter is an invalid cookie, or the caller does not have a read-only lock.

Remarks

This method will never return 0 unless the two anchors are in a single region. If the caller only requires information about whether the two anchors are positioned at the same location, ITfRange::IsEqualStart is more efficient.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header msctf.h
DLL Msctf.dll
Redistributable TSF 1.0 on Windows 2000 Professional

See also

ITfDocumentMgr::CreateContext

ITfEditSession::DoEditSession

ITfRange

ITfRange::CompareEnd

ITfRange::IsEqualStart

Text Stores

TfAnchor