You can set the range of a scroll bar using SetScrollInfo. You respond to movement by handling the WM_HSCROLL or WM_VSCROLL messages depending on whether the scroll bar is horizontal or vertical. This is slightly complicated, as you have to manually update the position. There is an example at MSDN:
Code:
case WM_HSCROLL:
{
SCROLLINFO si = { 0 };
int oldPos = 0;
si.cbSize = sizeof (si);
si.fMask = SIF_ALL;
GetScrollInfo (hwnd, SB_HORZ, &si);
// Save the position for comparison later on
oldPos = si.nPos;
switch (LOWORD (wParam))
{
// user clicked left arrow
case SB_LINELEFT:
si.nPos -= 1;
break;
// user clicked right arrow
case SB_LINERIGHT:
si.nPos += 1;
break;
// user clicked the scroll bar shaft left of the scroll box
case SB_PAGELEFT:
si.nPos -= si.nPage;
break;
// user clicked the scroll bar shaft right of the scroll box
case SB_PAGERIGHT:
si.nPos += si.nPage;
break;
// user dragged the scroll box
case SB_THUMBTRACK:
si.nPos = si.nTrackPos;
break;
default:
break;
}
// Set the position and then retrieve it. Due to adjustments
// by Windows it may not be the same as the value set.
si.fMask = SIF_POS;
SetScrollInfo (hwnd, SB_HORZ, &si, TRUE);
GetScrollInfo (hwnd, SB_HORZ, &si);
if (si.nPos != oldPos)
{
// If the position has changed, use the new value
}
return 0;
}
However, instead of using a scroll bar, I would strongly suggest you use a trackbar control.
As far as I know, you haven't offended anybody, some questions just slip by.