Function

Private Sub MiddleScroll()
Dim lXOffset As Long
Dim lYOffset As Long
Dim tP As POINTAPI
Dim tSIHorz As SCROLLINFO
Dim tSIVert As SCROLLINFO
Dim lVertOffset As Long
Dim lHorzOffset As Long
Dim lRes As Long
Dim lNewPos As Long
Dim bDoIt As Boolean

   GetCursorPos tP
   lXOffset = tP.X - m_tP.X
   lYOffset = tP.Y - m_tP.Y
   
   If (m_bHasHorizontalScroll) Then
      tSIHorz.cbSize = Len(tSIHorz)
      tSIHorz.fMask = SIF_RANGE Or SIF_PAGE Or SIF_POS Or SIF_TRACKPOS
      GetScrollInfo m_hWnd, SB_HO