The information in this article applies to:
SUMMARYThe current scroll bar position accompanying the SB_THUMBTRACK and SB_THUMBPOSITION type of scroll messages is only 16-bits wide. Functions such as GetScrollPos, SetScrollPos, GetScrollRange, and SetScrollRange can handle 32-bit value scroll-box positions. This article discusses how the GetScrollInfo call can be used to retrieve 32-bit scroll position during scroll messages. MORE INFORMATION
One of the arguments to the MFC scroll message handlers, OnHScroll and
OnVScroll, is the scroll box position. This argument is meaningful only in
the case of scroll messages with scroll bar code SB_THUMBPOSITION and
SB_THUMBTRACK. This value, even though of type UINT, is really of type
short int. In other words, the scroll thumb position is only 16-bits wide.
This behavior occurs because Windows sends the thumb position in the High
Word of WPARAM accompanying the scroll message. Q147684 BUG: Sending WM_xSCROLL Messages Causes Invalid ASSERTThis method of extracting 32-bit scroll box positions works only in those scroll messages that are sent to a window when the user grabs the thumb and drags it. It is not possible to obtain 32-bit scroll box position in cases of programmatically sent SB_THUMBTRACK and SB_THUMBPOSITION scroll messages. First, the 32-bit information cannot be packed into the WPARAM of the messages because only the High Word contains the scroll position. Second, the nTrackPos member of the SCROLLINFO structure maintained for scroll bars cannot be set programmatically. Any calls to SetScrollInfo to set the immediate scroll positions are ignored by the operating system. Sample Code
Additional query words: 2.00 2.10 2.20 4.00 4.10 3.00 3.10 3.20 4.00 4.10 kbinf
Keywords : kbMFC KbUIDesign kbVC |
Last Reviewed: August 5, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |