Because of the nature of how the WPARAM works when used in conjunction with this message, it is only able to store a 16-bit value for the offset position of the scrollbar (HIWORD( wParam )).
I haven’t used MFC, but this is the reason your variable is only able to maintain the range up to 32,767 units.
So, in the case of these two messages, you should actually get the offset directly from the control:
SCROLLINFO si;
…
case SB_THUMBTRACK : {
}
case SB_THUMBPOSITION : {
si.cbSize = sizeof( si );
si.fMask = SIF_TRACKPOS;
GetScrollInfo( m_hWnd, SB_VERT, &si );
yNewPos = si.nTrackPos;
break;
}
Here, my m_hWnd is a member of a class used for the base of a custom control. m_hWnd is the HWND handle to the actual control that has the scrollbar (of course!).
yNewPos is, clearly, the new Y position of the scrollbar, in 32 bits.
L. Spiro