Function fGetScrollBarPos(frm As Form) As Long
' Return ScrollBar Thumb position
' for the Vertical Scrollbar attached to the
' Form passed to this Function.
Dim hWndSB As Long
Dim lngret As Long
Dim sInfoH As SCROLLINFO
Dim sInfoV As SCROLLINFO
'Dim sInfo As SCROLLINFO
' Init SCROLLINFO structure
sInfoV.fMask = SIF_ALL
sInfoV.cbSize = Len(sInfoV)
sInfoV.nPos = 0
sInfoV.nTrackPos = 0
' Call function to get handle to
' ScrollBar control if it is visible
hWndSB = fIsScrollBar(frm) '*****************
'Debug.Print hWndSB
If hWndSB = -1 Then
fGetScrollBarPos = False '*******************
Exit Function
End If
' Get the window's ScrollBar position
lngret = apiGetScrollInfo(hWndSB, SB_CTL, sInfoV)
'Debug.Print "nPos:" & sInfoV.nPos & " nPage:" & sInfoV.nPage & " nMax:" & sInfoV.nMax; sInfoV.nTrackPos; sInfoV.fMask; sInfoV.nMin; sInfoV.cbSize
'MsgBox "getscrollinfo returned " & sInfo.nPos & " , " & sInfo.nTrackPos
fGetScrollBarPos = sInfoV.nPos + 1
End Function