PDA

Click to See Complete Forum and Search --> : Column Number


QWERTY
Nov 6th, 1999, 02:10 PM
Is it possible to find out what column cursor is in RTF? Word has that function so I guess it is possible. If you know something about it please let me know.
Thanks

------------------
Visual Basic Programmer (at least I want to be one)
------------------
PolComSoft
You will hear a lot about it.

Joacim Andersson
Nov 6th, 1999, 08:06 PM
Sure, first make the following declarations:

Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long

Private Const EM_LINEINDEX = &HBB

Then add the following function:

Private Function GetColumn(rtfBox As RichTextBox) As Long
Dim lngCharPos As Long
lngCharPos = SendMessage(rtfBox.hWnd, EM_LINEINDEX, rtfBox.GetLineFromChar(rtfBox.SelStart), 0&)
GetColumn = rtfBox.SelStart - lngCharPos
End Function

Good luck!



------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)

QWERTY
Nov 6th, 1999, 08:39 PM
Thanks

------------------
Visual Basic Programmer (at least I want to be one)
------------------
PolComSoft
You will hear a lot about it.