ITfRange interface (msctf.h)

The ITfRange interface is used by text services and applications to reference and manipulate text within a given context. The interface ID is IID_ITfRange.

Inheritance

The ITfRange interface inherits from the IUnknown interface. ITfRange also has these types of members:

Methods

The ITfRange interface has these methods.

 
ITfRange::AdjustForInsert

The ITfRange::AdjustForInsert method expands or contracts a range of text to adjust for text insertion.
ITfRange::Clone

The ITfRange::Clone method duplicates this range of text.
ITfRange::Collapse

The ITfRange::Collapse method clears the range of text by moving its start anchor and end anchor to the same position.
ITfRange::CompareEnd

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

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

ITfRange::GetContext method
ITfRange::GetEmbedded

The ITfRange::GetEmbedded method obtains content that corresponds to a TS_CHAR_EMBEDDED character in the text stream. The start anchor of the range of text is positioned just before the character of interest.
ITfRange::GetFormattedText

The ITfRange::GetFormattedText method obtains formatted content contained within a range of text. The content is packaged in an object that supports the IDataObject interface.
ITfRange::GetGravity

ITfRange::GetGravity method
ITfRange::GetText

The ITfRange::GetText method obtains the content covered by this range of text.
ITfRange::InsertEmbedded

The ITfRange::InsertEmbedded method inserts an object at the location of the start anchor of the range of text.
ITfRange::IsEmpty

The ITfRange::IsEmpty method verifies that the range of text is empty because the start and end anchors occupy the same position.
ITfRange::IsEqualEnd

The ITfRange::IsEqualStart method verifies that the end anchor of this range of text matches an anchor of another specified range.
ITfRange::IsEqualStart

The ITfRange::IsEqualStart method verifies that the start anchor of this range of text matches an anchor of another specified range.
ITfRange::SetGravity

ITfRange::SetGravity method
ITfRange::SetText

The ITfRange::SetText method replaces the content covered by the range of text.
ITfRange::ShiftEnd

ITfRange::ShiftEnd method
ITfRange::ShiftEndRegion

ITfRange::ShiftEndRegion method
ITfRange::ShiftEndToRange

ITfRange::ShiftEndToRange method
ITfRange::ShiftStart

ITfRange::ShiftStart method
ITfRange::ShiftStartRegion

ITfRange::ShiftStartRegion method
ITfRange::ShiftStartToRange

ITfRange::ShiftStartToRange method

Remarks

The TSF manager implements this interface. For more information about ranges, anchors, embedded objects, and other text properties used by TSF, see Ranges, Embedded Objects, and other topics within Using Text Services Framework.

Examples

Once an ITfComposition composition object is instantiated, a pointer to an ITfRange interface pointer can be obtained by calling the ITfComposition::GetRange method, as shown in the following code example.


HRESULT         hr;
ITfComposition  *pComposition;
ITfRange        *pRange;
WCHAR           *achBuffer[64];  // Buffer to receive text. 
ULONG           cch;

hr = pComposition->GetRange(&pRange);
if(SUCCEEDED(hr))
{
    // Loop to scan text: 

    do
    {
        cch = ARRAYSIZE(achBuffer);
        hr = pRange->GetText(ec, TF_TF_MOVESTART | TF_TF_IGNOREEND, achBuffer, cch, &cch);
        if(SUCCEEDED(hr))
        {
            // Do something with the text. 

            pRange->Release();
        }
    }
    while (cch == ARRAYSIZE(achBuffer));

    pComposition->Release();
}

A pointer to a current ITfRange object can be obtained from the <range> element of the TF_SELECTION structure.

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
Redistributable TSF 1.0 on Windows 2000 Professional

See also

Compositions

Embedded Objects

ITfComposition

ITfComposition::GetRange

IUnknown

Ranges

TF_SELECTION

Using Text Services Framework