GetScrollPos

2.x

  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 a 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 window that has standard scroll bars or a scroll bar control, depending on the value of the fnBar parameter.

fnBar

Specifies the scroll bar to examine. It can be one of the following values:

Value Meaning

SB_CTL Retrieves the position of a scroll bar control. In this case, the hwnd parameter must be the window handle of a scroll bar control.
SB_HORZ Retrieves the position of a window's horizontal scroll bar.
SB_VERT Retrieves the position of a window's vertical scroll bar.

Return Value

The return value specifies the current position of the scroll box in the scroll bar, if the function is successful. Otherwise, it is zero, indicating that the hwnd parameter is invalid or that the window does not have a scroll bar.

See Also

GetScrollRange, SetScrollPos, SetScrollRange