SBM_SETPOS message

The SBM_SETPOS message is sent to set the position of the scroll box (thumb) and, if requested, redraw the scroll bar to reflect the new position of the scroll box.

Applications should not send this message directly. Instead, they should use the SetScrollPos function. A window receives this message through its WindowProc function. Applications which implement a custom scroll bar control must respond to these messages for the SetScrollPos function to work properly.



Specifies the new position of the scroll box. It must be within the scrolling range. If this parameter is outside of the scrolling range, the value is rounded up or down to the nearest valid value.


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

Return value

ComCtl32.dll version 5.0: If the position of the scroll box changed, the return value is the previous position of the scroll box; otherwise, it is zero.

ComCtl32.dll version 6.0: The current position of the scroll box, regardless of whether it has changed.


If the scroll bar control is redrawn by a subsequent call to another function, setting the lParam parameter to FALSE is useful.


Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Winuser.h (include Windows.h)

See also