CreateTextServices function (textserv.h)

The CreateTextServices function creates an instance of a text services object. The text services object supports a variety of interfaces, including ITextServices and the Text Object Model (TOM).

Syntax

HRESULT CreateTextServices(
  IUnknown  *punkOuter,
  ITextHost *pITextHost,
  IUnknown  **ppUnk
);

Parameters

punkOuter

Type: IUnknown*

Pointer to the controlling IUnknown interface on the outer object if the text services object is being created as part of an aggregate object. This parameter can be NULL if the object is not part of an aggregate.

pITextHost

Type: ITextHost*

Pointer to your implementation of the ITextHost interface. This pointer must not be NULL.

ppUnk

Type: IUnknown**

Pointer to a variable that receives a pointer to the private IUnknown of the text services object. You can call QueryInterface on this pointer to retrieve ITextServices or ITextDocument interface pointers.

Return value

Type: HRESULT

If the text services object was created successfully, the return value is S_OK.

If the function fails, one of the following COM error codes are returned. For more information on COM error codes, see Error Handling in COM.

Return code Description
E_INVALIDARG
An invalid argument was passed in.
E_OUTOFMEMORY
Memory for text services object could not be allocated.
E_FAIL
The text services object could not be initialized.

Remarks

A text services object can be created as part of a standard COM-aggregated object. If it is, then callers should follow standard OLE32 rules for dealing with aggregated objects and caching interface pointers obtained through QueryInterface from the private IUnknown.

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header textserv.h
Library Riched20.lib
DLL Msftedit.dll

See also

Conceptual

ITextDocument

ITextHost

ITextServices

Reference

Windowless Rich Edit Controls