ChrisMancini
April 11th, 2001, 02:57 PM
Hi,
I am trying to retrieve the CaretPosition within a textbox. I have tried the following code:
GetCaretPos ptCaret
lPoint = (ptCaret.y * 65536) + (ptCaret.x And &HFFFF&)
lIndex = SendMessage(txtPrice.hwnd, EM_CHARFROMPOS, 0, lPoint)
If lIndex And &H8000& then
nCharIndex = lIndex Or &HFFFF0000
else
nCharIndex = lIndex And &HFFFF&
End If
GetCaretPos returns the correct x,y coordinates, but SendMessage always returns -1.
Any ideas????
Chris Mancini
I am trying to retrieve the CaretPosition within a textbox. I have tried the following code:
GetCaretPos ptCaret
lPoint = (ptCaret.y * 65536) + (ptCaret.x And &HFFFF&)
lIndex = SendMessage(txtPrice.hwnd, EM_CHARFROMPOS, 0, lPoint)
If lIndex And &H8000& then
nCharIndex = lIndex Or &HFFFF0000
else
nCharIndex = lIndex And &HFFFF&
End If
GetCaretPos returns the correct x,y coordinates, but SendMessage always returns -1.
Any ideas????
Chris Mancini