GetScrollBarInfo function (winuser.h)

The GetScrollBarInfo function retrieves information about the specified scroll bar.


BOOL GetScrollBarInfo(
  [in]  HWND           hwnd,
  [in]  LONG           idObject,


[in] hwnd

Type: HWND

Handle to a window associated with the scroll bar whose information is to be retrieved. If the idObject parameter is OBJID_CLIENT, hwnd is a handle to a scroll bar control. Otherwise, hwnd is a handle to a window created with WS_VSCROLL and/or WS_HSCROLL style.

[in] idObject

Type: LONG

Specifies the scroll bar object. This parameter can be one of the following values.

Value Meaning
The hwnd parameter is a handle to a scroll bar control.
The horizontal scroll bar of the hwnd window.
The vertical scroll bar of the hwnd window.

[out] psbi


Pointer to a SCROLLBARINFO structure to receive the information. Before calling GetScrollBarInfo, set the cbSize member to sizeof(SCROLLBARINFO).

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.


If idObject is OBJID_CLIENT and the window specified by hwnd is not a system scroll bar control, the system sends the SBM_GETSCROLLBARINFO message to the window to obtain scroll bar information. This allows GetScrollBarInfo to operate on a custom control that mimics a scroll bar. If the window does not handle the SBM_GETSCROLLBARINFO message, the GetScrollBarInfo function fails.


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
Redistributable Service Pack 6
API set ext-ms-win-ntuser-misc-l1-2-0 (introduced in Windows 8.1)

See also