共用方式為


CWnd::GetScrollPos

Retrieves the current position of the scroll box of a scroll bar.

int GetScrollPos(
   int nBar 
) const;

Parameters

  • nBar
    Specifies the scroll bar to examine. The parameter can take one of the following values:

    • SB_HORZ   Retrieves the position of the horizontal scroll bar.

    • SB_VERT   Retrieves the position of the vertical scroll bar.

Return Value

Specifies the current position of the scroll box in the scroll bar if successful; otherwise 0.

Remarks

The current position is a relative value that depends on the current scrolling range. For example, if the scrolling range is 50 to 100 and the scroll box is in the middle of the bar, the current position is 75.

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

GetScrollPos

CScrollBar::GetScrollPos

Concepts

CWnd Members