8. Scroll Bars Messages
Windows sends the window procedure WM_SCROLL and WM_HSCROLL messages when the scroll bar is clicked with the mouse or the thumb dragged. Each mouse action on the scroll bar generates at least two messages, one when the mouse button is pressed and another when it is released.
The wParam message parameter contains more information about the scrolll bar message. Some of the notification codes are:
SB_LINEUP |
When the scroll bar moves up by a line. |
SB_PAGEUP |
When the scroll bar moves up by several lines. |
SB_TOP |
When the scroll bar reaches the top. |
SB_THUMBTRACK |
Reports the position as the thumb is being dragged. |
SB_THUMBPOSITION |
Position of the thumb when it is clicked. |
SB_ENDSCROLL |
When the thumb is released. |
A program usually tracks either the SB_THUMBTRACK or SB_THUMBPOSITON messages, but does not do both. |