CWnd::SetScrollInfo

BOOL SetScrollInfo( int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE );

Return Value

If successful, the return is TRUE. Otherwise, it is FALSE.

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:

lpScrollInfo

A pointer to a SCROLLINFO structure. See the Win32 SDK Programmer’s Reference for more information about this structure.

bRedraw

Specifies whether the scroll bar should be redrawn to reflect the new position. If bRedraw is TRUE, the scroll bar is redrawn. If it is FALSE, it is not redrawn. The scroll bar is redrawn by default.

Remarks

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

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 Win32 SDK Programmer’s Reference 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.

Note   CWnd::GetScrollInfo enables applications to use 32-bit scroll-bar positions.

CWnd OverviewClass MembersHierarchy Chart

See Also   CWnd::GetScrollInfo, CWnd::SetScrollPos, CWnd::OnVScroll, CWnd::OnHScroll, SCROLLINFO