i want to scroll some content in a static control. first of all i added WS_VSCROLL style in CreateWindowEx of the static control. when i started the program i noticed, that i even wasn't able to click on this little arrows, nothing happened. then i found a code to scroll by Ron Thomas:
but even now, nothing happened. so i tried to change the handle "hBox" to my main window's handle at added a scrollbar to my main window. the scrolling worked fine. it was possible to click the arrows, aso. the static control also has SS_OWNERDRAW style, but when i removed that i had the same problem. then i removed the scrollbars from the main window again, and tried to subclass my static contol, 'cause i thought that i have to catch the WM_VSCROLL message in the window proc of the static control. but again, nothing happened. has anybody of you an idea what could be the problem, or perhaps a ready code for a static control with scrolling?
.elseif uMsg == WM_VSCROLL ; Get vertical scroll bar info mov sci.cbSize,sizeof sci mov sci.fMask,SIF_ALL invoke GetScrollInfo, hBox, SB_VERT, ADDR sci mov eax,sci.nPos mov iVertPos,eax ; Save position for later comparison LOWORD wParam ; Get mouse notification code (eax) .IF eax==SB_TOP mov eax,sci.nMin mov sci.nPos,eax .ELSEIF eax==SB_BOTTOM mov eax,sci.nMax mov sci.nPos,eax .ELSEIF eax==SB_LINEUP ; Clicked top arrow of SB dec sci.nPos .ELSEIF eax==SB_LINEDOWN ; Clicked bottom arrow of SB inc sci.nPos .ELSEIF eax==SB_PAGEUP ; Clicked area between top of SB and Thumb mov eax,sci.nPage ; Subtract # lines of displayable text sub sci.nPos,eax .ELSEIF eax==SB_PAGEDOWN ; Clicked area between Thumb and bottom of SB mov eax,sci.nPage ; Add # lines of displayable text add sci.nPos,eax .ELSEIF eax==SB_THUMBTRACK mov eax,sci.nTrackPos ; Get current positiom of scroll bar (ebx) mov sci.nPos,eax .ENDIF ; Set position and retrieve it; adjustments by Windows may result in a different value mov sci.fMask,SIF_POS invoke SetScrollInfo, hBox, SB_VERT, ADDR sci, TRUE invoke GetScrollInfo, hBox, SB_VERT, ADDR sci ; If position changes, scroll the window & update it mov eax,iVertPos .IF sci.nPos != eax mov eax,iVertPos sub eax,sci.nPos invoke ScrollWindow, hBox, 0, eax, NULL, NULL invoke UpdateWindow, hBox .ENDIF
, The problem is that a STATIC control does not accept any user input. If you really want to use a static control to display text in, make it a child of a normal CreateWindowEx style window and scroll it. Also compliments on your web site, it has stuff that many people will find useful. Regards, firstname.lastname@example.org
hey hutch--, thanx for the compliment. one question to this scrolling stuff again: what should i do when i want to scroll a bitmap? what would be the best way to display a scrolling bitmap? bye