SetScrollPos - Access is denied.



  • ich versuch seit stunden meine verdammte wrapper klasse für scrollbars zu erweitern, aber es geht wiedermal fast gar nichts.
    das ding wird normal hinzugefügt und angezeigt die WM_HSCROLL und WM_VSCROLL nachrichten werden richtig empfangen, aber die position von dem gottverdammten ding zu setzen funktioniert nicht.
    jeder aufruf von SetScrollPos gibt 0 zurück, also fehler. GetLastError gibt 5 zurück, also access denied.
    hier ein beispiel des aufrufs:

    cons<<"SetScrollPos:"<<SetScrollPos((HWND)lParam, SB_CTL, 5, TRUE)<<"\n";
    

    lParam ist das fensterhandle, es funktioniert sowieso ganz normal wenn ich ein globales handle ohne die wrapperklasse erstelle. aber so immer nur

    ERROR_ACCESS_DENIED

    5 (0x5)

    Access is denied.

    hab jetzt noch rausgefunden dass SetScrollRange wegen invalid handle fehlschlägt, obwohl das handle normal mit CreateWindow erstellt wurde und die scrollbar auch zu sehen ist.



  • lparam != NULL?

    If the message is sent by a scroll bar control, this parameter is the handle to the scroll bar control. If the message is sent by a standard scroll bar, this parameter is NULL.

    lParam ist das fensterhandle, es funktioniert sowieso ganz normal wenn ich ein globales handle ohne die wrapperklasse erstelle.

    fensterhandle oder controlhandle?

    edit: blubb
    grad nochmal post von dir genauer durchgelesen, lies dir mal msdn seite durch oder lies obigen quote:
    http://msdn.microsoft.com/en-us/library/windows/desktop/bb787597(v=vs.85).aspx

    Handle to a scroll bar control or a window with a standard scroll bar, depending on the value of the nBar parameter.
    [...]
    SB_CTL
    Sets the position of the scroll box in a scroll bar control. The hwnd parameter must be the handle to the scroll bar control.


Anmelden zum Antworten