SetScrollRange

2.x

  void SetScrollRange(hwnd, fnBar, nMin, nMax, fRedraw)    
  HWND hwnd; /* handle of window with scroll bar */
  int fnBar; /* scroll bar flag, */  
  int nMin; /* minimum scrolling position, */  
  int nMax; /* maximum scrolling position, */  
  BOOL fRedraw; /* redraw flag, */  

The SetScrollRange function sets minimum and maximum position values for the given scroll bar. It can also be used to hide or show standard scroll bars.

Parameters

hwnd

Identifies a window or a scroll bar, depending on the value of fnBar.

fnBar

Specifies the scroll bar to be set. This parameter can be one of the following values:

Value Meaning

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

nMin

Specifies the minimum scrolling position.

nMax

Specifies the maximum scrolling position.

fRedraw

Specifies whether the scroll bar should be redrawn to reflect the change. If this parameter is TRUE, the scroll bar is redrawn. If it is FALSE, the scroll bar is not redrawn.

Return Value

This function does not return a value.

Comments

An application should not call this function to hide a scroll bar while processing a scroll-bar notification message.

If the call to SetScrollRange immediately follows the call to the SetScrollPos function, the fRedraw parameter in SetScrollPos should be zero, to prevent the scroll bar from being drawn twice.

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

difference between the values specified by the nMin and nMax parameters must not be greater than 32,767.

See Also

GetScrollPos, GetScrollRange, ScrollWindow, SetScrollPos