I would like to know how can I get the cursor position in a RichTextControl using SendMessage API.
In fact, I want to get the column position of the cursor in the current line.
Many thanks,
Thierry
Printable View
I would like to know how can I get the cursor position in a RichTextControl using SendMessage API.
In fact, I want to get the column position of the cursor in the current line.
Many thanks,
Thierry
You can use the GetLineFromChar method.
Code:iLine = RichTextBox1.GetLineFromChar(RichTextBox1.SelStart) + 1
I know how to get the current line.
What I would like to know is the number of characters from the begin of the current line !...
Example :
This is
my text
If the cursor is between the 't' and 'e' letters of 'text' word, I would like to get the position '5'.
Many Thanks,
Thierry
Try this:
Code:MsgBox Len(Left(Text1.Text, Text1.SelStart))
This give you the position from the beginning of the text.
If my current line is 2, I want to get the position from the beginning of line # 2.
Thanks,
Thierry