WM_HSCROLL
wScrollCode = wParam; /* scroll bar code */
nPos = LOWORD(lParam); /* current position of scroll box */
hwndCtl = (HWND) HIWORD(lParam); /* handle of the control */
The WM_HSCROLL message is sent to a window when the user clicks the window's horizontal scroll bar.
wScrollCode
Value of wParam. Specifies a scroll bar code that indicates the user's scrolling request. This parameter can be one of the following values:
Value | Description |
SB_LEFT | Scroll to far left. |
SB_LINELEFT | Scroll left. |
SB_LINERIGHT | Scroll right. |
SB_PAGELEFT | Scroll one page left. |
SB_PAGERIGHT | Scroll one page right. |
SB_RIGHT | Scroll to far right. |
SB_THUMBPOSITION | Scroll to absolute position. The current position is specified by the nPos parameter. |
SB_THUMBTRACK | Drag scroll box (thumb) to specified position. The current position is specified by the nPos parameter. |
nPos
Value of the low-order word of lParam. Specifies the current position of the scroll box if the wScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, the nPos parameter is not used.
hwndCtl
Value of the high-order word of lParam. Identifies the control if WM_HSCROLL is sent by a scroll bar. If WM_HSCROLL is sent as a result of the user clicking a pop-up window's scroll bar, the high-order word is not used.
An application should return zero if it processes this message.
The SB_THUMBTRACK scroll bar code typically is used by applications that give some feedback while the scroll box is being dragged.
If an application scrolls the contents of the window, it must also reset the position of the scroll box by using the SetScrollPos function.