All pastes #40899 Raw Edit

Someone

public text v1 · immutable
#40899 ·published 2006-02-09 20:16 UTC
rendered paste body
    Private Enum EMFlags
        EM_SETSCROLLPOS = &H400 + 222
    End Enum


    Private Declare Function GetScrollRange Lib "User32" (ByVal hWnd As IntPtr, ByVal nBar As Integer, ByRef lpMinPos As Integer, ByRef lpMaxPos As Integer) As Boolean
    Private Overloads Declare Auto Function SendMessageSP Lib "user32" Alias "SendMessageA" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As POINT) As IntPtr
    Public Shared Sub ScrollToBottom(ByVal Handle As IntPtr, ByVal Height As Long)
        Dim Min, Max As Integer
        GetScrollRange(Handle, ScrollBarFlags.SBS_VERT, Min, Max)
        SendMessageSP(Handle, EMFlags.EM_SETSCROLLPOS, 0, New Point(0, Max - Height))
        
    End Sub