SetScrollRange

Syntax

void SetScrollRange(hWnd,nBar,nMinPos,nMaxPos,bRedraw)

This function sets minimum and maximum position values for the given scroll bar. It can also be used to hide or show standard scroll bars by setting the nMinPos and nMaxPos parameters to zero.

Parameter Type/Description  

hWnd HWND Identifies a window or a scroll-bar control, depending on the value of the nBar parameter.  
nBar int Specifies the scroll bar to be set. It 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 a window's horizontal scroll-bar range.
  SB_VERT Sets a window's vertical scroll-bar range.
nMinPos int Specifies the minimum scrolling position.  
nMaxPos int Specifies the maximum scrolling position.  
bRedraw BOOL Specifies whether or not the scroll bar should be redrawn to reflect the change. If the bRedraw parameter is nonzero, the scroll bar is redrawn. If it is zero, it is not redrawn.  

Return Value

None.

Comments

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

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

The difference between the values specified by the nMinPos and nMaxPos parameters must not be greater than 32,767.