ITfContextView::GetRangeFromPoint method (msctf.h)

The ITfContextView::GetRangeFromPoint method converts a point, in screen coordinates, to an empty range of text positioned at a corresponding location.

Syntax

HRESULT GetRangeFromPoint(
  [in]  TfEditCookie ec,
  [in]  const POINT  *ppt,
  [in]  DWORD        dwFlags,
  [out] ITfRange     **ppRange
);

Parameters

[in] ec

Specifies the edit cookie with read-only access.

[in] ppt

Specifies the point in screen coordinates.

[in] dwFlags

Specifies the range position to return based upon the screen coordinates of the point to a character bounding box. By default, the range position returned is the character bounding box containing the screen coordinates of the point. If the point is outside a character bounding box, the method returns NULL or TF_E_INVALIDPOINT. Other bit flags for this parameter are as follows.

The bit flags can be combined.

Value Meaning
GXFPF_ROUND_NEAREST
If the screen coordinates of the point are contained in a character bounding box, the range position returned is the bounding edge closest to the screen coordinates of the point.
GXFPF_NEAREST
If the screen coordinates of the point are not contained in a character bounding box, the closest range position is returned.

[out] ppRange

Receives a pointer to the ITfRange interface.

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
TF_E_INVALIDPOINT
The pptScreen parameter does not cover any document text.
TF_E_NOLAYOUT
The application has not calculated a text layout.
TF_E_NOLOCK
The specified edit cookie is invalid.

Remarks

Point 1 is in character bounding box and point 2 is outside the character bounding box. By default, the method will return a range positioned at 0 for point 1 and TF_E_INVALIDPOINT for point 2. If the dwFlags parameter is set to GXFPF_ROUND_NEAREST, the method returns range position 1 for point 1. If the dwFlags parameter is set to GXFPF_NEAREST then the method returns range position 2 for point 2.

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

GXFPF_NEAREST

GXFPF_ROUND_NEAREST

ITfContextView

TF_E_INVALIDPOINT