void InitSlider(HWND hwnd)
{
// Initialize the trackbar range, but disable the
// control until the user opens a file.
hScroll = GetDlgItem(hwnd, IDC_SLIDER1);
SendMessage(hScroll, TBM_SETRANGE, TRUE, MAKELONG(0, 100));
}
case WM_HSCROLL:
short int userReq = LOWORD(wParam);
if (userReq == TB_ENDTRACK || userReq == TB_THUMBTRACK)
{
DWORD dwPosition = SendMessage(hTrackbar, TBM_GETPOS, 0, 0);
// Pause when the scroll action begins. // save current state
if (bStartOfScroll)
{
...
bStartOfScroll = FALSE;
}
// Update the position continuously.
...
// Restore the state at the end.
if (userReq == TB_ENDTRACK)
{
...
bStartOfScroll = TRUE;
}
}
}