SW_SMOOTHSCROLL ScrollWindowEx

Viewed 52

How to use the flag SW_SMOOTHSCROLL of the WinApi ScrollWindowEx?

SW_SMOOTHSCROLL Scrolls using smooth scrolling. Use the HIWORD portion of the flags parameter to indicate how much time, in milliseconds, the smooth-scrolling operation should take.

Independent of what value I input as the time 100 or 9999, it continues scrolling with the same speed, would like to ask if someone knows how to properly use this flag?

   case WM_VSCROLL:
   {
        RECT rc;
        int CurPos = scrollY;
        int TemPos = CurPos;
        switch (LOWORD(wParam))
        {
            case SB_TOP:            CurPos = 0; break;
            case SB_LINEUP:         CurPos = (CurPos > 0)? CurPos - 1 : 0; break;
            case SB_THUMBPOSITION:  CurPos = HIWORD(wParam); break;
            case SB_THUMBTRACK:     CurPos = HIWORD(wParam); break;
            case SB_LINEDOWN:       CurPos = (CurPos < 240)? CurPos + 1 : 240; break;
            case SB_BOTTOM:         CurPos = 240; break;
            case SB_ENDSCROLL:      break;
        }
    
      SetScrollPos(hwnd, SB_VERT, CurPos, TRUE);
      TemPos = CurPos - TemPos;

      UINT flags;
      flags = MAKELONG(SW_SCROLLCHILDREN | SW_SMOOTHSCROLL | SW_ERASE |
      SW_INVALIDATE, 100);
        
      ScrollWindowEx(hwnd, 0, -, NULL, NULL, NULL, NULL, flags);
    
      break;
   }
0 Answers
Related