BOOL EnableScrollBar(hwnd, fnSBFlags, fuArrowFlags) | |||||
HWND hwnd; | /* handle of window or scroll bar | */ | |||
int fnSBFlags; | /* scroll-bar type flag | */ | |||
UINT fuArrowFlags; | /* scroll-bar arrow flag | */ |
The EnableScrollBar function enables or disables one or both arrows of a scroll bar.
hwnd
Identifies a window or a scroll bar, depending on the value of the fnSBFlags parameter.
fnSBFlags
Specifies the scroll bar type. This parameter can be one of the following values:
Value | Meaning |
SB_BOTH | Enables or disables the arrows of the horizontal and vertical scroll bars associated with the given window. The hwnd parameter identifies the window. |
SB_CTL | Identifies the scroll bar as a scroll bar control. The hwnd parameter must identify a scroll bar control. |
SB_HORZ | Enables or disables the arrows of the horizontal scroll bar associated with the given window. The hwnd parameter identifies the window. |
SB_VERT | Enables or disables the arrows of the vertical scroll bar associated with the given window. The hwnd parameter identifies the window. |
fuArrowFlags
Specifies whether the scroll bar arrows are enabled or disabled, and which arrows are enabled or disabled. This parameter can be one of the following values:
Value | Meaning |
ESB_ENABLE_BOTH | Enables both arrows of a scroll bar. |
ESB_DISABLE_LTUP | Disables the left arrow of a horizontal scroll bar, or the up arrow of a vertical scroll bar. |
ESB_DISABLE_RTDN | Disables the right arrow of a horizontal scroll bar, or the down arrow of a vertical scroll bar. |
ESB_DISABLE_BOTH | Disables both arrows of a scroll bar. |
The return value is nonzero if the arrows are enabled or disabled as specified. Otherwise, it is zero, indicating that the arrows are already in the requested state or that an error occurred.
The following example enables an edit control's vertical scroll bar when the control receives the input focus, and disables the scroll bar when the control loses the focus:
case EN_SETFOCUS:
EnableScrollBar(hwndMLEdit, SB_VERT, ESB_ENABLE_BOTH);
break;
case EN_KILLFOCUS:
EnableScrollBar(hwndMLEdit, SB_VERT, ESB_DISABLE_BOTH);
break;