Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
Windows Controls
Control Library
Scroll Bar
 ShowScrollBar function
ShowScrollBar function

Applies to: desktop apps only

The ShowScrollBar function shows or hides the specified scroll bar.

Syntax

BOOL ShowScrollBar(
  __in  HWND hWnd,
  __in  int wBar,
  __in  BOOL bShow
);

Parameters

hWnd [in]

Type: HWND

Handle to a scroll bar control or a window with a standard scroll bar, depending on the value of the wBar parameter.

wBar [in]

Type: int

Specifies the scroll bar(s) to be shown or hidden. This parameter can be one of the following values.

ValueMeaning
SB_BOTH

Shows or hides a window's standard horizontal and vertical scroll bars.

SB_CTL

Shows or hides a scroll bar control. The hwnd parameter must be the handle to the scroll bar control.

SB_HORZ

Shows or hides a window's standard horizontal scroll bars.

SB_VERT

Shows or hides a window's standard vertical scroll bar.

 

bShow [in]

Type: BOOL

Specifies whether the scroll bar is shown or hidden. If this parameter is TRUE, the scroll bar is shown; otherwise, it is hidden.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

You should not call this function to hide a scroll bar while processing a scroll bar message.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

EnableScrollBar

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Conflicts with visual animation      ahmd0   |   Edit   |   Show History
This API seems to have a bug that manifests itself under Windows Vista and Windows 7. The following happens. In case this API is called to remove scrollbar(s) for a window while those scrollbars were displaying a fade-in/fade-out animation (when a user hovers the mouse pointer over it) that animation continues even if scrollbar(s) themselves are removed. That results in a visual "artifact" of the scrollbar(s) still remaining on the screen (that a user can no longer click on).

This bug seems to be present at least on systems with the default "glass" themes enabled.

Here's a Visual C++ project that I made to demonstrate the issue:
http://www.codeguru.com/forum/attachment.php?attachmentid=28366&;;d=1304880496
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker