GetScrollPos

  int GetScrollPos(hwnd, fnBar)    
  HWND hwnd; /* handle of window with scroll bar */
  int fnBar; /* scroll bar flags */

The GetScrollPos function retrieves the current position of the scroll box (thumb) of the given 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.

Parameters

hwnd

Identifies a scroll bar control or a window with a standard scroll bar, depending on the value of the fnBar parameter.

fnBar

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. In this case, the hwnd parameter must be the handle of a 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 Value

The return value specifies the current position of the scroll box if the function is successful, or zero if an error occurs. To obtain extended error information, use the GetLastError function.

See Also

GetScrollRange, ScrollDC, ScrollWindow, SetScrollPos, SetScrollRange