i'm testing the win32 scrollbars, but i'm with 1 problem: when i use the SB_THUMBPOSITION message, why the window isn't repainted( the WM_PAINT message isn't used)?

case WM_VSCROLL:
            switch (LOWORD (wParam))
            {
                case SB_LINEUP:
                    VerticalScroll-=1;
                    break;
                case SB_LINEDOWN:
                    VerticalScroll+=1;
                    break;
                case SB_THUMBPOSITION:
                    VerticalScroll=HIWORD (wParam);
                    break;
                case SB_PAGEDOWN:
                    VerticalScroll+=10;
                    break;
                case SB_PAGEUP:
                    VerticalScroll-=10;
                    break;
            }
            SetScrollPos (hwnd, SB_VERT, VerticalScroll, TRUE) ;
            InvalidateRect(hwnd,NULL,TRUE);
            return 0;

Edited 2 Years Ago by cambalinho

MSDN Says:

Note The SetScrollPos function is provided for backward compatibility. New applications should use the SetScrollInfo function.

I think you need to call GetScrollPos first to get the current position then call SetScrollPos to change it.

Comments
thanks

isn't that problem. the problem was that i didn't use the SB_THUMBTRACK scrollbar message.

case WM_VSCROLL:
            si.cbSize = sizeof(si);
            si.fMask  = SIF_ALL;
            GetScrollInfo (hwnd, SB_VERT, &si);
            switch (LOWORD (wParam))
            {
                case SB_TOP:
                    VerticalScroll=0;
                    return 0;
                case SB_BOTTOM:
                    VerticalScroll=VerticalScrollSize;
                    return 0;
                case SB_LINEUP:
                    VerticalScroll-=ScrollMove;
                    break;
                case SB_LINEDOWN:
                    VerticalScroll+=ScrollMove;
                    break;
                case SB_THUMBPOSITION:
                    VerticalScroll=HIWORD (wParam);
                    break;
                case SB_THUMBTRACK:
                    VerticalScroll=HIWORD (wParam);
                    break;
                case SB_PAGEDOWN:
                    VerticalScroll+=ScrollMove*10;
                    break;
                case SB_PAGEUP:
                    VerticalScroll-=ScrollMove*10;
                    break;
            }
            if (VerticalScroll<=0) VerticalScroll=0;
            if (VerticalScroll>=VerticalScrollSize) VerticalScroll=VerticalScrollSize;
            si.nMin = 0;
            si.nPos = VerticalScroll;
            si.nMax = VerticalScrollSize-2;
            si.nPage=2;
            SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
            InvalidateRect(hwnd, NULL, TRUE);
            return 0;

now works fine.. thanks
and yes i must use the ScrollInfo() functions with SCROLLINFO structure.
i hope these problem helps others ;)

This question has already been answered. Start a new discussion instead.