ITfDocumentMgr::CreateContext method (msctf.h)

Creates a context object.

Syntax

HRESULT CreateContext(
  [in]  TfClientId   tidOwner,
  [in]  DWORD        dwFlags,
  [in]  IUnknown     *punk,
  [out] ITfContext   **ppic,
  [out] TfEditCookie *pecTextStore
);

Parameters

[in] tidOwner

The client identifier. For an application, this value is provided by a previous call to ITfThreadMgr::Activate. For a text service, this value is provided in the text service ITfTextInputProcessor::Activate method.

[in] dwFlags

Reserved, must be zero.

[in] punk

Pointer to an object that supports the ITextStoreACP or ITfContextOwnerCompositionSink interfaces. This value can be NULL.

[out] ppic

Address of an ITfContext pointer that receives the context.

[out] pecTextStore

Pointer to a TfEditCookie value that receives an edit cookie for the new context. This value identifies the context in various methods.

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
E_INVALIDARG
One or more parameters are invalid.
E_OUTOFMEMORY
A memory allocation error occurred.
E_FAIL
An unspecified error occurred.

Remarks

All references to the punk parameter are released when the context is destroyed or when the context is removed from the stack with the ITfDocumentMgr::Pop method.

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

ITextStoreACP

ITfContext

ITfContextOwnerCompositionSink

ITfDocumentMgr

ITfDocumentMgr::Pop

ITfTextInputProcessor::Activate

ITfThreadMgr::Activate

TfEditCookie