网站首页  词典首页

请输入您要查询的函数:

 

术语 getscrollinfo
释义 GetScrollInfo
语法:
BOOL GetScrollInfo( HWND hwnd,
int fnBar,
LPSCROLLINFO lpsi
);
GetScrollInfo函数
该GetScrollInfo函数检索滚动条参数,包括最低和最高滚动立场,页面大小,并滚动框(拇指)的立场。
参数
hwnd
[in]句柄滚动条控制或与一个标准的滚动条的窗口,这取决于该fnBar参数的值。
fnBar
[in]指定的滚动条的检索参数的类型。此参数可以是下列值之一。
SB_CTL
检索参数滚动条控制。在hwnd参数必须处理的滚动条控制。
SB_HORZ
检索参数为窗口的标准Level滚动条。
SB_VERT
检索参数为窗口的标准垂直滚动条。
lpsi
[中,out]指向1 SCROLLINFO结构。在调用GetScrollInfo,设置cbSize成员为sizeof(SCROLLINFO),并设置fMask成员指定滚动条的参数来检索。在返回的功能复制到结构适当的成员指定的参数。
该fMask成员可以是一个或多个下列值。
SIF_PAGE
滚动页面复制到SCROLLINFO结构nPage成员指向lpsi。
SIF_POS
滚动位置复制到SCROLLINFO结构npos返回成员指向lpsi。
SIF_RANGE
复制滚动范围的无机氮和SCROLLINFO结构nMax成员指向lpsi。
SIF_TRACKPOS
将当前的位置滚动框追踪到SCROLLINFO结构nTrackPos成员指向lpsi。
返回值
如果该函数检索任何值,返回值为非零值。
如果该函数不检索任何值,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
该GetScrollInfo函数使应用程序能够使用32位滚动位置。尽管消息显示滚动条的位置,WM_HSCROLL和WM_VSCROLL,只提供16个位置数据,职能SetScrollInfo和GetScrollInfo提供32位的滚动条位置的数据位。因此,一个应用程序可以调用GetScrollInfo在处理要么WM_HSCROLL或WM_VSCROLL消息获得32位滚动条位置数据。
为了让32位的滚动框(拇指期间在WM_HSCROLL或WM_VSCROLL消息,请拨打GetScrollInfo SB_THUMBTRACK要求与在SCROLLINFO结构fMask成员SIF_TRACKPOS值的代码)的立场。该函数返回在SCROLLINFO结构nTrackPos成员跟踪滚动框的位置。这使您可以获取滚动框的定位为用户移动它。下面的示例代码说明了这种技术。
SCROLLINFO si;
case WM_HSCROLL:
switch(LOWORD(wparam)) {
case SB_THUMBTRACK:
// Initialize SCROLLINFO structure

ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
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;
.
.
.
}
如果fnBar参数SB_CTL和hwnd参数指定的窗口不是一个滚动条控制系统,该系统发送SBM_GETSCROLLINFO信息获取的窗口滚动条信息。这使得GetScrollInfo运作自定义控件模仿一个滚动条。如果窗口不处理SBM_GETSCROLLINFO消息,GetScrollInfo函数失败。
功能信息
最低DLL版本 comctl32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.51
参见
SCROLLINFO,SetScrollInfo,WM_HSCROLL,WM_VSCROLL
==英文原文==GetScrollInfo Function
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).
Syntax
BOOL GetScrollInfo( HWND hwnd,
int fnBar,
LPSCROLLINFO lpsi
);
Parameters
hwnd
[in] Handle to a scroll bar control or a window with a standard scroll bar, depending on the value of the fnBar parameter.
fnBar
[in] Specifies the type of scroll bar for which to retrieve parameters. This parameter can be one of the following values.
SB_CTL
Retrieves the parameters for a scroll bar control. The hwnd parameter must be the handle to 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.
lpsi
[in, out] Pointer to a SCROLLINFO structure. Before calling GetScrollInfo, set the cbSize member 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 one or more of the following values.
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 Value
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 request code 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(si));
si.cbSize = sizeof(si);
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;
.
.
.
}
If the fnBar parameter is SB_CTL and the window specified by the hwnd parameter is not a system scroll bar control, the system sends the SBM_GETSCROLLINFO message to the window to obtain scroll bar information. This allows GetScrollInfo to operate on a custom control that mimics a scroll bar. If the window does not handle the SBM_GETSCROLLINFO message, the GetScrollInfo function fails.
Function Information
Minimum DLL Versioncomctl32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.51
See Also
SCROLLINFO , SetScrollInfo , WM_HSCROLL , WM_VSCROLL
==原始网址==http://msdn.microsoft.com/en-us/library/bb787583(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:22:01