The SetScrollRange function sets the minimum and maximum position values for the specified scroll bar.
The SetScrollRange function is provided for backward compatibility. New applications should use the SetScrollInfo function.
BOOL SetScrollRange(
HWND hWnd, |
// handle of window with scroll bar |
int nBar, |
// scroll bar flag |
int nMinPos, |
// minimum scrolling position |
int nMaxPos, |
// maximum scrolling position |
BOOL bRedraw |
// redraw flag |
); |
Value |
Meaning |
SB_CTL |
Sets the range of a scroll bar control. The hWnd parameter must be the handle of the 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. |
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
You can use SetScrollRange to hide the scroll bar by setting nMinPos and nMaxPos to the same value. An application should not call the SetScrollRange function to hide a scroll bar while processing a scroll bar message. New applications should use the ShowScrollBar function to hide the scroll bar.
If the call to SetScrollRange immediately follows a call to the SetScrollPos function, the bRedraw parameter in SetScrollPos must 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 parameter values are zero). The difference between the values specified by the nMinPos and nMaxPos parameters must not be greater than the value of MAXLONG.
Because the messages that indicate scroll bar position, WM_HSCROLL and WM_VSCROLL, are limited to 16 bits of position data, applications that rely solely on those messages for position data have a practical maximum value of 65,535 for the SetScrollRange function’s nMaxPos parameter.
However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.
GetScrollInfo, GetScrollPos, GetScrollRange, SetScrollInfo, SetScrollPos, ShowScrollBar
file: /Techref/os/win/api/win32/func/src/f81_11.htm, 5KB, , updated: 2000/4/7 11:19, local time: 2024/11/24 18:28,
3.15.239.145:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/TECHREF/os/win/api/win32/func/src/f81_11.htm"> SetScrollRange</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.