GetScrollPos
The GetScrollPos function retrieves the current position of the scroll box (thumb) in the specified scroll bar. The current position is a relative value that depends on the current scrolling range. For example, if the scrolling range is 0 through 100 and the scroll box is in the middle of the bar, the current position is 50. The GetScrollPos function is provided for backward compatibility. New applications should use the GetScrollInfo function. int GetScrollPos(
  HWND hWnd, // handle to window with scroll bar
  int nBar   // scroll bar flags
);
 
Parameters
hWnd 
Handle to a scroll bar control or a window with a standard scroll bar, depending on the value of the nBar parameter. 
nBar 
Specifies the scroll bar to be examined. This parameter can be one of the following values: Value Meaning 
SB_CTL Retrieves the position of the scroll box in a scroll bar control. The hWnd parameter must be the handle to the scroll bar control. 
SB_HORZ Retrieves the position of the scroll box in a window's standard horizontal scroll bar. 
SB_VERT Retrieves the position of the scroll box in a window's standard vertical scroll bar. 
Return Values
If the function succeeds, the return value is the current position of the scroll box.If the function fails, the return value is zero. To get extended error information, callGetLastError. Res
The GetScrollPos function enables applications to use 32-bit scroll positions. Although the messages that indicate scroll bar position, WM_HSCROLL and WM_VSCROLL, are limited to 16 bits of position data, the functions SetScrollPos, SetScrollRange, GetScrollPos, and GetScrollRange support 32-bit scroll bar position data. Thus, an application can call GetScrollPos while processing either the WM_HSCROLL or WM_VSCROLL messages to obtain 32-bit scroll bar position data. To get the 32-bit position of the scroll box (thumb) during a SB_THUMBTRACK notification in a WM_HSCROLL or WM_VSCROLL message, use the GetScrollInfo function.QuickInfo
  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in winuser.h.
  Import Library: Use user32.lib.