SetScrollInfo/GetScrollInfo - Sinn und Zweck des Kombo?



  • Hier mal kurzer Codeausschnitt (copy vom petzold - Programm SYSMETS3.C)

    case WM_HSCROLL:
        si.cbSize=sizeof--8si-9,
        si.fMask=SIF_ALL;
        GetScrollInfo(hwnd,SB_HORZ,&si);
        iHorzPos=si.nPos;
    
        switch(LOWORD(wParam))
        {
            case SB_LINELEFT:
                si.nPos-=1;
            break;
            // etc. um das gehts nicht
        }
        si.fMask=SIF_POS;
    
        /* HIER */
        // Zuerst wird hier SetScrollInfo aufgerufen - gut, aber wieso holt man sich die gleichen Daten danach sofort wieder?? :open_mouth:
        SetScrollInfo(hwnd,SB_HORZ,&si,TRUE);
        GetScrollInfo(hwnd,SB_HORZ,&si);
    
        // Wenn sich die Position geändert hat, Fensterinhalt scrollen (gelöscht darum gehts net)
    return(0);
    

    Welchen Sinn hat dieses Kombo? Werte setzen und Werte sofort wieder holen? Ändert da Windows noch etwas? Wenn ja was? Oder hat das einen anderen Grund?

    MfG SideWinder



  • // Set the position and then retrieve it.  Due to adjustments
                   //   by Windows it may not be the same as the value set.
    


  • benjie schrieb:

    // Set the position and then retrieve it.  Due to adjustments
                   //   by Windows it may not be the same as the value set.
    

    Ja und was für "adjustments" macht Windows da noch? Was gitbs da noch zum Richten an den Werten?

    MfG SideWinder



  • The SetScrollInfo function performs range checking on the values specified by the nPage and nPos members of the SCROLLINFO structure. The nPage member must specify a value from 0 to nMax - nMin +1. The nPos member must specify a value between nMin and nMax - max( nPage 1, 0). If either value is beyond its range, the function sets it to a value that is just within the range.



  • Also sozusagen: Wenn der User noch immer auf den Pfeil nach oben drückt, obwohl der Thumb schon oben ist setze ich trotzdem noch die Position immer um -1 nach "oben". Damit das nicht passiert prüft Windows die Werte.

    Okay alles klar, danke :).

    MfG SideWinder


Anmelden zum Antworten