ITfProperty::FindRange method (msctf.h)

Obtains a range that covers the text that contains a non-empty value for the property.

Syntax

HRESULT FindRange(
  [in]  TfEditCookie ec,
  [in]  ITfRange     *pRange,
  [out] ITfRange     **ppRange,
  [in]  TfAnchor     aPos
);

Parameters

[in] ec

Contains an edit cookie that identifies the edit context. This is obtained from ITfDocumentMgr::CreateContext or ITfEditSession::DoEditSession.

[in] pRange

Pointer to an ITfRange interface that contains the point to obtain the property range for. The point will either be the start anchor or end anchor of this range, based upon the value of aPos.

[out] ppRange

Pointer to an ITfRange interface pointer that receives the requested range object.

[in] aPos

Contains one of the TfAnchor values which specifies which anchor of pRange is used as the point to obtain the property range for.

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
S_FALSE
pRange is not over, or adjacent to, the property. ppRange receives NULL.
E_INVALIDARG
One or more parameters are invalid.
E_OUTOFMEMORY
A memory allocation failure occurred.
E_FAIL
An unspecified error occurred.
TF_E_NOLOCK
The edit context identified by ec does not have a read-only or read/write lock.

Remarks

This method obtains a range of text that contains a non-empty value for the property. If the property has no value at the specified point, ppRange receives NULL and the method returns S_FALSE. In the following example, if aPos contains TF_ANCHOR_START, the returned range would contain "is". If aPos contains TF_ANCHOR_END, the method would return S_FALSE because the property does not exist at the end point of the range.


COLOR: RRRRR   RR          GGGGGGGG
TEXT:  this <a>is som</a>e colored text

If aPos contains TF_ANCHOR_START, this method ignores property ranges that end immediately before the start anchor. Likewise, if aPos contains TF_ANCHOR_END, this method ignores property ranges that start immediately after the end anchor. In the following example, if aPos contains TF_ANCHOR_START, the returned range would contain "colored " and not "some " because the R value property ends at the start anchor point and the G value property begins at the start anchor. If aPos contains TF_ANCHOR_END, the returned range would contain "colored " and not "text".


COLOR:         RRRRR   GGGGGGGG    BBBB
TEXT:  this is some <a>colored </a>text

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

ITfProperty

ITfRange

TfAnchor