Newsgroups: comp.windows.ms.programmer Path: utzoo!utgpu!watserv1!watmath!hyper.hyper.com!bonneau From: bonneau@hyper.hyper.com (Paul Bonneau) Subject: Re: Temporarily adding scrollbars to window Message-ID: <1991Apr14.175209.25965@hyper.hyper.com> Reply-To: bonneau@hyper.UUCP (Paul Bonneau,,) Organization: HyperCube Inc. References: <1991Apr12.044108.4007@mnemosyne.cs.du.edu> Date: Sun, 14 Apr 1991 17:52:09 GMT In article <1991Apr12.044108.4007@mnemosyne.cs.du.edu> ebergman@isis.cs.du.edu (Eric Bergman-Terrell) writes: > >Folks: > >I'm trying to temporarily add horizontal and vertical scroll bars to a >window. > >Will SetWindowLong() do this? > >If so, how must it be used? I'm trying sumething like the following: > >SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL); > The problem is that non-client area scrollbars are actually child windows that are automatically created when the parent window is created. So they will not exist when you change the parent's window style, and there will be nothing to display. What you need to do is create the parent window with the WS_VSCROLL style and then hide the scroll bar with SetScrollRange(hwndParent, SB_VERT, 0, 0, TRUE);. When it is time to show the scrollbar, give it a non-null scroll range and it will appear. cheers - Paul Bonneau.