GetScrollRange

  BOOL GetScrollRange(hwnd, fnBar, lpMinPos, lpMaxPos)    
  HWND hwnd; /* handle of window with scroll bar */
  int fnBar; /* scroll bar flags */
  LPINT lpMinPos; /* address of variable that receives minimum position */
  LPINT lpMaxPos; /* address of variable that receives maximum position */

The GetScrollRange function retrieves the current minimum and maximum scroll bar positions for the given scroll bar.

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 whose positions are to be retrieved. This parameter can be one of the following values:

Value Meaning

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

lpMinPos

Points to the integer variable that receives the minimum position.

lpMaxPos

Points to the integer variable that receives the maximum position.

Return Value

The return value is TRUE if the function is successful, or FALSE if an error occurs. To obtain extended error information, use the GetLastError function.

Comments

If the given window does not have standard scroll bars or is not a scroll bar control, the GetScrollRange function copies zero to the lpMinPos and lpMaxPos parameters.

The default range for a standard scroll bar is 0 through 100. The default range for a scroll bar control is empty (both values are zero).

See Also

GetScrollPos, SetScrollPos, SetScrollRange