CWnd::GetScrollInfo

Call this member function to retrieve the information that the SCROLLINFO structure maintains about a scroll bar.

BOOL GetScrollInfo(
   int nBar,
   LPSCROLLINFO lpScrollInfo,
   UINT nMask = SIF_ALL 
);

Parameters

  • nBar
    Specifies whether the scroll bar is a control or part of a window's nonclient area. If it is part of the nonclient area, nBar also indicates whether the scroll bar is positioned horizontally, vertically, or both. It must be one of the following:

    • SB_CTL   Retrieves the parameters for a scroll bar control. The m_hWnd data member must be the handle of the scroll bar control.

    • SB_HORZ   Retrieves the parameters for the window's standard horizontal scroll bar.

    • SB_VERT   Retrieves the parameters for the window's standard vertical scroll bar.

  • lpScrollInfo
    A pointer to a SCROLLINFO structure. See the Windows SDK for more information about this structure.

  • nMask
    Specifies the scroll bar parameters to retrieve. The default specifies a combination of SIF_PAGE, SIF_POS, SIF_TRACKPOS, and SIF_RANGE. See SCROLLINFO for more information on the nMask values.

Return Value

If the message retrieved any values, the return is TRUE. Otherwise, it is FALSE.

Remarks

GetScrollInfo enables applications to use 32-bit scroll positions.

The SCROLLINFO structure contains information about a scroll bar, including the minimum and maximum scrolling positions, the page size, and the position of the scroll box (the thumb). See the SCROLLINFO structure topic in the Windows SDK for more information about changing the structure defaults.

The MFC Windows message handlers that indicate scroll-bar position, CWnd::OnHScroll and CWnd::OnVScroll, provide only 16 bits of position data. GetScrollInfo and SetScrollInfo provide 32 bits of scroll-bar position data. Thus, an application can call GetScrollInfo while processing either CWnd::OnHScroll or CWnd::OnVScroll to obtain 32-bit scroll-bar position data.

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CScrollBar::GetScrollInfo

CWnd::SetScrollInfo

CWnd::SetScrollPos

CWnd::OnVScroll

CWnd::OnHScroll

SCROLLINFO

Concepts

CWnd Members

Change History

Date

History

Reason

December 2010

Changed the nBar parameter description to match the GetScrollInfo function in the Windows SDK.

Customer feedback.