BOOL SetScrollRange(hwnd, fnBar, nMinPos, nMaxPos, fRedraw) | |||||
HWND hwnd; | /* handle of window with scroll bar | */ | |||
int fnBar; | /* scroll bar flag | */ | |||
int nMinPos; | /* minimum scrolling position | */ | |||
int nMaxPos; | /* maximum scrolling position | */ | |||
BOOL fRedraw; | /* redraw flag | */ |
The SetScrollRange function sets the minimum and maximum position values for the given scroll bar. It can also be used to hide or show a standard scroll bar by setting the nMinPos and nMaxPos parameters to zero.
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 set. This parameter can be one of the following values:
Value | Meaning |
SB_CTL | ||
Sets the range of a scroll bar control. In this case, the hwnd parameter must be the handle of a scroll bar control. | ||
SB_HORZ | ||
Sets the range of a window's standard horizontal scroll bar. | ||
SB_VERT | ||
Sets the range of a window's standard vertical scroll bar. |
nMinPos
Specifies the minimum scrolling position.
nMaxPos
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.
The return value is TRUE if the function is successful or FALSE if an error occurs.
An application should not call this function to hide a scroll bar while processing a scroll-bar 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 nMinPos and nMaxPos values are zero). The difference between the values specified by the nMinPos and nMaxPos parameters must not be greater than 32,767.
GetScrollPos, GetScrollRange, SetScrollPos