scrollbars
-
creating scrollbar.... case WM_CREATE: sb1 = CreateWindowEx( 0L, // no extended styles "SCROLLBAR", // scroll bar control class (LPSTR) NULL, // text for window title bar WS_CHILD | SBS_HORZ | WS_VISIBLE, // scroll bar styles 50, // horizontal position 20, // vertical position 200, // width of the scroll bar 100, // default height hwnd, // handle to main window (HMENU) NULL, // no menu for a scroll bar hInst, // instance owning this window (LPVOID) NULL // pointer not needed ); ............. and then in the message loop: //------------------------------------------------- case WM_HSCROLL:{ int xNewPos; // new position switch (LOWORD(wParam)) { // User clicked the shaft left of the scroll box. case SB_PAGEUP: xNewPos = xCurrentScroll - 50; break; // User clicked the shaft right of the scroll box. case SB_PAGEDOWN: xNewPos = xCurrentScroll + 50; break; // User clicked the left arrow. case SB_LINEUP: xNewPos = xCurrentScroll - 5; break; // User clicked the right arrow. case SB_LINEDOWN: xNewPos = xCurrentScroll + 5; break; // User dragged the scroll box. case SB_THUMBPOSITION: xNewPos = HIWORD(wParam); break; default: xNewPos = xCurrentScroll; }; if (xNewPos == xCurrentScroll) break; xCurrentScroll = xNewPos; si.cbSize = sizeof(si); si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS ; si.nMax = 300; si.nMin = 0; si.nPage = 4; si.nPos = xCurrentScroll; SetScrollInfo(sb1, SB_HORZ, &si, true); InvalidateRect( hwnd, NULL, TRUE ); } //-------------------------------------- the new one shows over the old one. i.e the scrollbar with the height of 100 which i set up shows over the one with the default height, and dont update. The old one does update when i press the on the new. visual example, from the code above this happens. http://i3.photobucket.com/albums/y98/lamefif/scrollbar.jpg[^] many thanks