ITextStoreACP2::QueryInsert method (textstor.h)

Determines whether the specified start and end character positions are valid. Use this method to adjust an edit to a document before executing the edit. The method must not return values outside the range of the document.

Syntax

HRESULT QueryInsert(
  [in]  LONG  acpTestStart,
  [in]  LONG  acpTestEnd,
  [in]  ULONG cch,
  [out] LONG  *pacpResultStart,
  [out] LONG  *pacpResultEnd
);

Parameters

[in] acpTestStart

Starting application character position for inserted text.

[in] acpTestEnd

Ending application character position for the inserted text. This value is equal to acpTextStart if the text is inserted at a point instead of replacing selected text.

[in] cch

Length of replacement text.

[out] pacpResultStart

Returns the new starting application character position of the inserted text. If this parameter is NULL, then text cannot be inserted at the specified position. This value cannot be outside the document range.

[out] pacpResultEnd

Returns the new ending application character position of the inserted text. If this parameter is NULL, then pacpResultStart is set to NULL and text cannot be inserted at the specified position. This value cannot be outside the document range.

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
E_FAIL
An unspecified error occurred.
E_INVALIDARG
The acpTestStart or acpTestEnd parameters are invalid.

Remarks

The values of pacpResultStart and pacpResultEnd depend upon how the application inserts text into the document. If pacpResultStart and pacpResultEnd are the same as acpTextStart, the cursor is at the beginning of the inserted text after insertion. If pacpResultStart and pacpResultEnd are the same as acpTextEnd, the cursor is at the end of the inserted text after insertion. If the difference between pacpResultStart and pacpResultEnd is equal to the length of the inserted text, the inserted text is highlighted after insertion.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header textstor.h
DLL Msctf.dll

See also

ITextStoreACP2