# Function Reference

# _GUICtrlRichEdit_GotoCharPos

Moves the insertion point to an inter-character position

#include <GuiRichEdit.au3>
_GUICtrlRichEdit_GotoCharPos ( $hWnd, $iCharPos )

## Parameters

$hWnd | Handle to the control
$iCharPos | the inter character position Special value: -1 - end of text

## Return Value

Success: | True.
Failure: | False and sets the @error flag to non-zero.
@error: | 101 - $hWnd is not a handle 102 - $iCharPos is neither a positive number nor zero nor -1 103 - $iCharPos exceeds the number of characters in the control

## Remarks

The first character of the text in a control is at character position 0.
Cancels text selection (if any).

## Related

_GUICtrlRichEdit_SetSel

## See Also

Search EM_EXSETSEL in MSDN Library.

## Example

    #include <GUIConstantsEx.au3>
    #include <GuiRichEdit.au3>
    #include <WindowsStylesConstants.au3>

    Example()

    Func Example()
        Local $hGui, $iMsg, $hRichEdit
        $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)
        $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
                BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
        GUISetState(@SW_SHOW)

        _GUICtrlRichEdit_SetText($hRichEdit, "This is a test.")
        _GUICtrlRichEdit_GotoCharPos($hRichEdit, 8)

        While True
            $iMsg = GUIGetMsg()
            Select
                Case $iMsg = $GUI_EVENT_CLOSE
                    _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes
                    ; GUIDelete()   ; is OK too
                    Exit
            EndSelect
        WEnd
    EndFunc   ;==>Example