Results 1 to 2 of 2

Thread: RichTextBox question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    New Delhi, India
    Posts
    75
    I am trying to find the scroll Position in a Rechtextbox control. but I am always getting 0,0 as the coordinate. The function SendMessage is always returning 0 which mean something is wrong. This function should return 1 which means successful execution. But somehow I am not getting the answer right. Can somebody help me what am I doing wrong here.


    'Declaration in Form Module

    Private Sub Command1_Click()
    Dim udtScrollPos As tagPOINT
    Dim lngWin32apiResultCode As Long

    With RichTextBox1
    lngWin32apiResultCode = _
    SendMessage(.hwnd, _
    EM_GETSCROLLPOS, _
    0, _
    udtScrollPos)
    End With

    With udtScrollPos
    Label3.Caption = "(" & .x & "-" & .y & ")"
    End With
    End Sub


    'Declaration in General Module

    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 WM_USER As Long = &H400
    Public Const EM_GETSCROLLPOS = WM_USER + 221

    Type tagPOINT
    x As Long
    y As Long
    End Type

  2. #2
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    The MSDN states that this only works on rich edit controls version 3.0 and above.
    Last edited by Lord Orwell; Mar 20th, 2001 at 04:04 AM.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

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