please dont rip this site Prev Next

GetScrollInfo info  Overview  Group

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 SCROLLINFO structure. Before calling GetScrollInfo, set the cbSize member of the structure to sizeof(SCROLLINFO), and set the fMask member to specify 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 SCROLLINFO 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.

SIF_TRACKPOS

Copies the current scroll box tracking position to the nTrackPos member 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. To get extended error information, call GetLastError.

Remarks

The GetScrollInfo function enables applications to use 32-bit scroll positions. Although the messages that indicate scroll-bar position, WM_HSCROLL and WM_VSCROLL, provide only 16 bits of position data, the functions SetScrollInfo 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.

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 GetScrollInfo with the SIF_TRACKPOS value in the fMask member of the SCROLLINFO structure. The function returns the tracking position of the scroll box in the nTrackPos member of the SCROLLINFO structure. 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;

        .

        .

        .

    }

See Also

SCROLLINFO, SetScrollInfo, WM_HSCROLL, WM_VSCROLL


file: /Techref/os/win/api/win32/func/src/f38_7.htm, 7KB, , updated: 2000/4/7 12:19, local time: 2024/10/3 03:41,
TOP NEW HELP FIND: 
35.171.164.77:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/techref/os/win/api/win32/func/src/f38_7.htm"> GetScrollInfo</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .