int minpos; int maxpos;
pScrollBar->GetScrollRange(&minpos, &maxpos); int curpos = pScrollBar->GetScrollPos(); switch(nSBCode)
{ case SB_LEFT: //Scrolls to the lower right.
curpos = minpos; break;
case SB_RIGHT: //Scrolls to the lower right.
curpos = maxpos; break;
case SB_ENDSCROLL: //Ends scroll. break;
case SB_LINEDOWN: //Scrolls one line down.
curpos++; break;
case SB_LINEUP: //Scrolls one line up.
curpos--; break;
case SB_PAGEDOWN: //Scrolls one page down.
curpos+=5; break;
case SB_PAGEUP: //Scrolls one page up.
curpos-=5; break;
case SB_THUMBPOSITION: //The user has dragged the scroll box (thumb) and released the mouse button. The nPos parameter indicates the position of the scroll box at the end of the drag operation.
curpos = nPos; break;
case SB_THUMBTRACK: //The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The nPos parameter indicates the position that the scroll box has been dragged to.
curpos = nPos; break;
}