Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!mcnc!rti!bcw From: bcw@rti.rti.org (Bruce Wright) Newsgroups: comp.windows.ms.programmer Subject: Re: Temporarily adding scrollbars to window Summary: Why add scroll bars to window attributes? Message-ID: <1991Apr13.230011.3681@rti.rti.org> Date: 13 Apr 91 23:00:11 GMT References: <1991Apr12.044108.4007@mnemosyne.cs.du.edu> Organization: Research Triangle Institute, RTP, NC Lines: 25 In article <1991Apr12.044108.4007@mnemosyne.cs.du.edu>, ebergman@isis.cs.du.edu (Eric Bergman-Terrell) writes: > > 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); > > But it doesn't work... Do I also need to call ShowWindow() and/or > UpdateWindow()? You probably can add scroll bars dynamically to a a window this way - but you'd certainly have to call ShowWindow again, and probably UpdateWindow as well. But this looks like the hard way to do it - you can just call SetScrollRange (hWnd, SB_VERT, 0, 0, TRUE) and voila - the vertical scroll bar goes away, or SetScrollRange (hWnd, SB_VERT, 0, 100, TRUE) and it comes back again. I'm not sure I see why you need to mess around with SetWindowLong ... Bruce C. Wright