Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function retrieves the parameters of a scroll bar, including the minimum and maximum scrolling positions, the page size, and the position of the scroll box (thumb).
BOOL GetScrollInfo( HWND hwnd , int fnBar , LPSCROLLINFO lpsi );
Parameters
Value | Description |
---|---|
SB_CTL | Retrieves the parameters for a scroll bar control. The hwndparameter must be the handle to the scroll bar control. |
SB_HORZ | Retrieves the parameters for the given window's standard horizontal scroll bar. |
SB_VERT | Retrieves the parameters for the given window's standard vertical scroll bar. |
The fMaskmember can be a combination of the following values:
Value | Description |
---|---|
SIF_PAGE | Copies the scroll page to the nPagemember of the SCROLLINFOstructure pointed to by lpsi. |
SIF_POS | Copies the scroll position to the nPosmember of the SCROLLINFOstructure pointed to by lpsi. |
SIF_RANGE | Copies the scroll range to the nMinand nMaxmembers of the SCROLLINFOstructure pointed to by lpsi. |
SIF_TRACKPOS | Copies the current scroll box tracking position to the nTrackPosmember of the SCROLLINFOstructure pointed to by lpsi. |
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
The GetScrollInfofunction enables applications to use 32-bit scroll positions. Although the messages that indicate scroll-bar position, WM_HSCROLLand WM_VSCROLL, provide only 16 bits of position data, the functions SetScrollInfo and GetScrollInfoprovide 32 bits of scroll-bar position data. Thus, an application can call GetScrollInfowhile processing either the WM_HSCROLL or WM_VSCROLL messages to obtain 32-bit scroll-bar position data.
To get the 32-bit position of the scroll box (thumb) during a SB_THUMBTRACK notification in a WM_HSCROLL or WM_VSCROLL message, call GetScrollInfowith the SIF_TRACKPOS value in the fMaskmember of the SCROLLINFOstructure. The function returns the tracking position of the scroll box in the nTrackPosmember of the SCROLLINFOstructure. This allows you to get the position of the scroll box as the user moves it. The following sample code illustrates the technique.
SCROLLINFO si; case WM_HSCROLL: switch(LOWORD(wparam)) { case SB_THUMBTRACK: // Initialize SCROLLINFO structure ZeroMemory(&si, sizeof(SCROLLINFO)); si.cbSize = sizeof(SCROLLINFO); si.fMask = SIF_TRACKPOS; // Call GetScrollInfo to get current tracking // position in si.nTrackPos if (!GetScrollInfo(hwnd, SB_HORZ, &si) ) return 1; // GetScrollInfo failed break; . . . }
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winuser.h | Sbcmn.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
SCROLLINFO, SetScrollInfo, WM_HSCROLL, WM_VSCROLL