GetScrollBarInfo function
Applies to: desktop apps only
The GetScrollBarInfo function retrieves information about the specified scroll bar.
Syntax
BOOL GetScrollBarInfo( __in HWND hwnd, __in LONG idObject, __out PSCROLLBARINFO psbi );
Parameters
- hwnd [in]
-
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.
- idObject [in]
-
Type: LONG
Specifies the scroll bar object. This parameter can be one of the following values.
Value Meaning - OBJID_CLIENT
The hwnd parameter is a handle to a scroll bar control.
- OBJID_HSCROLL
The horizontal scroll bar of the hwnd window.
- OBJID_VSCROLL
The vertical scroll bar of the hwnd window.
- psbi [out]
-
Type: PSCROLLBARINFO
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.
Remarks
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.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Redistributable | Service Pack 6 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 3/6/2012
1.)
The width of a horizontal scrollbar thumb is never shorter than SM_CXHTHUMB (17 pixel) in some applications with Comctl 6.1
The width of a horizontal scrollbar thumb is never shorter than 8 pixel in some other applications with Comctl 5.82
This way the scrollbar is painted inconsistent depending on the ComCtl32.dll version.
But GetScrollBarInfo retuns always the 8 pixel minimum thumb width although the scrollbar thumb is painterd as 17 pixel by Comctl version 6.1.
2.)
If you test the whole stuff in a dialog with WS_EX_LAYOUTRTL it becomes even worse.
Now the horizontal scrollbar returns a completely invalid thumb position.
This applies to ComCtl version 5.8 and 6.0.
The strangest thing is that a Scrollbar control (OBJID_CLIENT) works correctly while the bugs affect only OBJID_HSCROLL and OBJID_VSCROLL!
It returns FALSE and GetLastError() returns 0 if called from the GUI thread.
It returns FALSE and GetLastError() returns ERROR_MORE_DATA or ERROR_FILE_NOT_FOUND if called from another thread.
This applies only to applications that use ComCtl.dll version 6.
This does not apply to applications that use ComCtl.dll version 5.
This does not apply to Windows Vista.
This does not apply to OBJID_HSCROLL and OBJID_VSCROLL.
___________________________________________________________
There is another bug at least on Windows Vista:
If you call this command with OBJID_CLIENT on a Gripper the returned rcScrollBar has a size of 0x0 pixels.