GetScrollInfo  FV1TSR 

The GetScrollInfo 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,

// handle of window with scroll bar

    int fnBar,

// scroll bar flag

    LPSCROLLINFO lpsi

// pointer to structure for scroll parameters

   );

 

 

Parameters

hwnd

Identifies a scroll bar control or a window with a standard scroll bar, depending on the value of the fnBar parameter.

fnBar

Specifies the type of scroll bar for which to retrieve parameters. This parameter can be one of the following values:

Value

Meaning

SB_CTL

Retrieves the parameters for a scroll bar control. The hwnd parameter must be the handle of 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.

 

 

lpsi

Points to a SCROLLINFO2MGX.WM structure whose fMask member, upon entry to the function, specifies the scroll bar parameters to retrieve. Before returning, the function copies the specified parameters to the appropriate members of the structure.

The fMask member can be a combination of the following values:

Value

Meaning

SIF_PAGE

Copies the scroll page to the nPage member of the SCROLLINFO2MGX.WM structure pointed to by lpsi.

SIF_POS

Copies the scroll position to the nPos member of the SCROLLINFO structure pointed to by lpsi.

SIF_RANGE

Copies the scroll range to the nMin and nMax members of the SCROLLINFO structure pointed to by lpsi.

 

Return Values

If the function retrieved any values, the return value is nonzero.

If the function does not retrieve any values, the return value is zero.

Remarks

The GetScrollInfo function enables applications to use 32-bit scroll positions. Although the messages that indicate scroll-bar position, WM_HSCROLLE_2M08 and WM_VSCROLL1I8PUW5, provide only 16 bits of position data, the functions SetScrollInfoHKI_O0 and GetScrollInfo provide 32 bits of scroll-bar position data. Thus, an application can call GetScrollInfo while processing either the WM_HSCROLL or WM_VSCROLL messages to obtain 32-bit scroll-bar position data.

The limitation on this technique applies to real-time scrolling of a window s contents. An application implements real-time scrolling by processing the WM_HSCROLL or WM_VSCROLL messages that carry the SB_THUMBTRACK notification value, thereby tracking the position of the scroll box (thumb) as the user moves it. Unfortunately, there is no function to retrieve the 32-bit position scroll-box position as the user moves the scroll box. Because GetScrollInfo provides only the static position, an application can obtain only 32-bit position data before or after a scroll operation.

See Also

SCROLLINFO, SetScrollInfo, WM_HSCROLL, WM_VSCROLL