Plug-in Reference — Inline Functions — Editor_SetCaretPosEx

# Editor_SetCaretPosEx

Moves the cursor position and optionally extends the selection. You can use this inline function or explicitly send the EE_SET_CARET_POS message.

Editor_SetCaretPosEx( HWND hwnd, int nLogical, POINT_PTR* pptPos, BOOL bExtend );

## Parameters

hwnd

Specifies the window handle of the view or frame of EmEditor.

nLogical

Specifies one of the following values.

Value | Meaning
--- | ---
POS_VIEW | Display Coordinates
POS_LOGICAL_A | Logical Coordinates (Count double-byte characters as two)
POS_LOGICAL_W | Logical Coordinates (Count double-byte characters as one)
POS_SCROLL_ALWAYS | When used with POS_SCROLL_CENTER or POS_SCROLL_TOP, the cursor position moves even if the current cursor position is already visible.
POS_SCROLL_CENTER | The cursor position becomes near the center of the window.
POS_SCROLL_DONT_CARE | The cursor position becomes where the scrolling becomes minimum.
POS_SCROLL_TOP | The cursor position becomes the top of the window.

pptPos

Pointer to a POINT_PTR structure that specified the cursor position.

bExtend

Determines whether to extend the current selection. If bExtend is TRUE, then the active end of the selection moves to the location while the anchor end remains where it is. Otherwise, both ends are moved to the specified location.

## Return Values

The return value is not used.

## Version

Supported on Version 4.03 or later. However, POS_SCROLL_DONT_CARE, POS_SCROLL_CENTER, and POS_SCROLL_TOP flags are supported on Version 6.00 or later. POS_SCROLL_ALWAYS is supported on Version 7.00.4 or later.