Where do you mean? In the chat window, you have the history area (where the sent and received messages are) and the typing area (where you type your messages).
For the first one, there are ChatWnd.HistoryText_GetCurSelStart() and ChatWnd.HistoryText_GetCurSelEnd() functions which let you get the current selection in the history. However, it is not possible to set the selection there.
For the second one, you can use ChatWnd.EditText_GetCurSelStart() and ChatWnd.EditText_GetCurSelEnd() to retrieve the selection and use ChatWnd.EditText_SetCurSel(Start, End) to set it.
Note: if the start and end of a selection are equal, it means that the typing cursor is at that position and has nothing selected. That's what your flickering vertical line is.
Although I don't really understand what you mean with "setting the window's position to the cursor's"...