Results 1 to 3 of 3

Thread: Column Number

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    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.


  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    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
    [email protected]
    [email protected]
    www.YellowBlazer.com



  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    Thanks

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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width