Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#1

Scrollbar position ist falsch

  Alt 3. Aug 2017, 10:11
Ich setze beim Start der Anwendung mit SetScrollRange den Maximalen Scroll wert.
Im Timer wird die Position gesetzt.

Code:
SetScrollPos(hWnd, SBS_HORZ, (int)MilSecond, FALSE);
In WM_HSCROLL versuche ich die aktuelle Thumb Position in Erfahrung zu bringen.
Ich frage mich nun warum wird diese falsch ausgegeben?

Code:
LRESULT CALLBACK MovieProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    LONG64 Position = 0;

    switch (message)
    {
    case WM_HSCROLL:
    {
        switch LOWORD(wParam)
        {
        case SB_THUMBTRACK:
        {
            bIsTracking = TRUE;
        }

        break;
        case SB_ENDSCROLL:
        {
            bIsTracking = FALSE;
        }
        break;
        case SB_THUMBPOSITION:
        {
            Position = HIWORD(wParam);
            KVideo_SetStreamPosition(Position * 10000);
        }
        break;
        }
    }
    break;

    case WM_TIMER:
    {
        if (wParam = MOVIE_TIMER)
        {
            if (bIsTracking)
            {
                return 0;
                break;
            }

            if (TimerTick)
            {
                return 0;
                break;
            }
            if (aMediaProperty.PlaybackLength > 0)
            {
                MilSecond = KVideo_GetStreamPosition() / 10000;
                LONG64 Second = MilSecond / 1000;
               
                SetScrollPos(hWnd, SBS_HORZ, (int)MilSecond, FALSE);

                if (Second == LastPlayingPos)
                {
                    TimerTick = FALSE;
                    return 0;
                    break;
                }
                else
                    LastPlayingPos = Second;
            }
        }
    }
    break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
Die frage warum wird die falsche Position ausgegeben wenn ich den Thumb loslasse?

gruss
  Mit Zitat antworten Zitat