ITfInsertAtSelection::InsertTextAtSelection method (msctf.h)

Inserts text at the selection or insertion point.

Syntax

HRESULT InsertTextAtSelection(
  [in]  TfEditCookie ec,
  [in]  DWORD        dwFlags,
  [in]  const WCHAR  *pchText,
  [in]  LONG         cch,
  [out] ITfRange     **ppRange
);

Parameters

[in] ec

Identifies the edit context. This is obtained from ITfDocumentMgr::CreateContext or ITfEditSession::DoEditSession.

[in] dwFlags

Bit field with one of the following values.

Value Meaning
TF_IAS_NOQUERY
ppRange is NULL. This flag cannot be combined with the TF_IAS_QUERYONLY flag.
TF_IAS_QUERYONLY
The context is not modified, but ppRange is set as if the insert had occurred. Read-only access is sufficient. If this flag is not set, ec must have read/write access. This flag cannot be combined with the TF_IAS_NOQUERY flag.
TF_IAS_NO_DEFAULT_COMPOSITION
The manager will not create a default composition if a composition is required. The caller must create a composition object that covers the inserted text before releasing the context lock.

[in] pchText

Specifies the text to insert.

[in] cch

Specifies the character count of the text in pchText.

[out] ppRange

Receives the position of the inserted object.

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
TF_E_NOLOCK
The text service does not have a document lock
TF_E_DISCONNECTED
Context object is not on a document stack.
TS_E_NOSELECTION
Context has no selection.
TS_E_READONLY
Selection is read-only.

Remarks

To insert an IDataObject object instead of text, use ITfInsertAtSelection::InsertEmbeddedAtSelection.

Requirements

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

See also

IDataObject

ITfDocumentMgr::CreateContext

ITfEditSession::DoEditSession

ITfInsertAtSelection

ITfInsertAtSelection::InsertEmbeddedAtSelection