ITextStoreAnchor::GetText method (textstor.h)

The ITextStoreAnchor::GetText method returns information about text at a specified anchor position. This method returns the visible and hidden text and indicates if embedded data is attached to the text.

Syntax

HRESULT GetText(
  [in]  DWORD   dwFlags,
  [in]  IAnchor *paStart,
  [in]  IAnchor *paEnd,
  [out] WCHAR   *pchText,
  [in]  ULONG   cchReq,
  [out] ULONG   *pcch,
  [in]  BOOL    fUpdateAnchor
);

Parameters

[in] dwFlags

Not used; should be zero.

[in] paStart

Specifies the starting anchor position.

[in] paEnd

Specifies the ending anchor position. If NULL, it is treated as if it were an anchor positioned at the very end of the text stream.

[out] pchText

Specifies the buffer to receive the text. May be NULL only when cchReq = 0.

[in] cchReq

Specifies the pchText buffer size in characters.

[out] pcch

Receives the number of characters copied into the pchText buffer.

[in] fUpdateAnchor

If TRUE, paStart will be repositioned just past the last character copied to pchText.

Return value

This method can return one of these values.

Value Description
S_OK
The method completed successfully.
E_FAIL
The method was unable to obtain a valid interface pointer to paStart and/or paEnd.
TF_E_INVALIDPOS
The paStart or paEnd anchors are outside of the document text.
TS_E_NOLOCK
The caller does not have a read-only lock on the document.

Remarks

Callers that use this method must have a read-only lock on the document by calling the ITextStoreAnchor::RequestLock method. Without a read-only lock, the method fails and returns TF_E_NOLOCK.

Applications can truncate the method return values for internal reasons.

To quickly scan text with multiple GetText calls, a caller would use fUpdateAnchor = TRUE.

The actual number of characters copied could be less than cchReq if the number of characters between paStart and paEnd is less than cchReq.

The behavior of GetText is not affected by any region boundaries covered by the returned 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 textstor.h
DLL Msctf.dll
Redistributable TSF 1.0 on Windows 2000 Professional

See also

ITextStoreAnchor

ITextStoreAnchor::RequestLock

Manager Return Values

TS_RUNINFO