case WM_VSCROLL: switch(LOWORD (wParam)) { // User clicked the shaft above the scroll box.
case SB_PAGEUP: yInc = min(-1, -yClient / yChar); break;
// User clicked the shaft below the scroll box.
case SB_PAGEDOWN: yInc = max(1, yClient / yChar); break;
// User clicked the top arrow.
case SB_LINEUP: yInc = -1; break;
// User clicked the bottom arrow.
case SB_LINEDOWN: yInc = 1; break;
// User dragged the scroll box.
case SB_THUMBTRACK: yInc = HIWORD(wParam) - yPos; break;
default: yInc = 0;
}
// If applying the vertical scrolling increment does not // take the scrolling position out of the scrolling range, // increment the scrolling position, adjust the position // of the scroll box, and update the window. UpdateWindow // sends the WM_PAINT message.
switch(LOWORD (wParam))
{
// User clicked the shaft above the scroll box.
case SB_PAGEUP:
yInc = min(-1, -yClient / yChar);
break;
// User clicked the shaft below the scroll box.
case SB_PAGEDOWN:
yInc = max(1, yClient / yChar);
break;
// User clicked the top arrow.
case SB_LINEUP:
yInc = -1;
break;
// User clicked the bottom arrow.
case SB_LINEDOWN:
yInc = 1;
break;
// User dragged the scroll box.
case SB_THUMBTRACK:
yInc = HIWORD(wParam) - yPos;
break;
default:
yInc = 0;
}
// If applying the vertical scrolling increment does not
// take the scrolling position out of the scrolling range,
// increment the scrolling position, adjust the position
// of the scroll box, and update the window. UpdateWindow
// sends the WM_PAINT message.
if (yInc = max(-yPos, min(yInc, yMax - yPos)))
{
yPos += yInc;
ScrollWindow(hwnd, 0, -yChar * yInc,
(CONST RECT *) NULL, (CONST RECT *) NULL,
(HRGN) NULL, (LPRECT) NULL, SW_INVALIDATE);
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = YPos;
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
UpdateWindow (hwnd);
}