网站首页  词典首页

请输入您要查询的函数:

 

术语 setscrollpos
释义 SetScrollPos
语法:
int SetScrollPos( HWND hWnd,
int nBar,
int nPos,
BOOL bRedraw
);
SetScrollPos函数
该SetScrollPos函数设置滚动框(拇指在指定的滚动条)立场,并要求重绘滚动条,以反映新的滚动框的位置。
注意SetScrollPos函数是为了向后兼容。新的应用程序应该使用SetScrollInfo函数。
参数
hWnd
[in]句柄滚动条控制或与一个标准的滚动条的窗口,这取决于该nBar参数的值。
nBar
[in]指定滚动条被设置。此参数可以是下列值之一。
SB_CTL
设置在一个滚动条控制滚动框的位置。在hwnd参数必须处理的滚动条控制。
SB_HORZ
设置滚动框在一个窗口的标准Level滚动条的位置。
SB_VERT
设置滚动框在一个窗口的标准垂直滚动条的位置。
npos返回
[in]指定滚动框的新位置。这个职位必须在滚动的范围。如需有关滚动范围的信息,请参阅SetScrollRange功能。
bRedraw
[in]指定是否重绘滚动条,以反映新的滚动框的位置。如果此参数为TRUE,滚动条的重绘。如果是FALSE,则滚动条不重新划分。
返回值
如果函数成功,返回值是滚动框上的立场。
Windows XP:如果在桌面上为主题的父窗口是一个消息的唯一窗口,该函数返回一个不正确的值。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
如果重绘滚动条由后续调用另一个函数,参数设置bRedraw为FALSE是有益的。
由于消息,以表明滚动条的位置,WM_HSCROLL和WM_VSCROLL,被限制为16个位置的数据,应用依赖状况的数据,这些信息仅仅有1位为65,535为SetScrollPos函数的npos返回参数的实际最大的价值。
但是,由于SetScrollInfo,SetScrollPos,SetScrollRange,GetScrollInfo,GetScrollPos和GetScrollRange功能,支持32位的滚动条位置数据,有一种方法可以绕过16位的WM_HSCROLL和WM_VSCROLL消息的障碍。请参阅该技术的描述GetScrollInfo。
如果nBar参数SB_CTL和hWnd参数指定的窗口不是一个滚动条控制系统,该系统发送SBM_SETPOS信息,窗口设置滚动条信息。这使得SetScrollPos运作自定义控件模仿一个滚动条。如果窗口不处理SBM_SETPOS消息,SetScrollPos函数失败。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
参见
GetScrollInfo,GetScrollPos,GetScrollRange,SetScrollInfo,SetScrollRange
==英文原文==SetScrollPos Function
The SetScrollPos function sets the position of the scroll box (thumb) in the specified scroll bar and, if requested, redraws the scroll bar to reflect the new position of the scroll box.
Note The SetScrollPos function is provided for backward compatibility. New applications should use the SetScrollInfo function.
Syntax
int SetScrollPos( HWND hWnd,
int nBar,
int nPos,
BOOL bRedraw
);
Parameters
hWnd
[in] Handle to a scroll bar control or a window with a standard scroll bar, depending on the value of the nBar parameter.
nBar
[in] Specifies the scroll bar to be set. This parameter can be one of the following values.
SB_CTL
Sets the position of the scroll box in a scroll bar control. The hwnd parameter must be the handle to the scroll bar control.
SB_HORZ
Sets the position of the scroll box in a window's standard horizontal scroll bar.
SB_VERT
Sets the position of the scroll box in a window's standard vertical scroll bar.
nPos
[in] Specifies the new position of the scroll box. The position must be within the scrolling range. For more information about the scrolling range, see the SetScrollRange function.
bRedraw
[in] Specifies whether the scroll bar is redrawn to reflect the new scroll box position. If this parameter is TRUE, the scroll bar is redrawn. If it is FALSE, the scroll bar is not redrawn.
Return Value
If the function succeeds, the return value is the previous position of the scroll box.
Windows XP: If the desktop is themed and the parent window is a message-only window , the function returns an incorrect value.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
If the scroll bar is redrawn by a subsequent call to another function, setting the bRedraw parameter to FALSE is useful.
Because the messages that indicate scroll bar position, WM_HSCROLL and WM_VSCROLL , are limited to 16 bits of position data, applications that rely solely on those messages for position data have a practical maximum value of 65,535 for the SetScrollPos function's nPos parameter.
However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo , GetScrollPos , and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.
If the nBar parameter is SB_CTL and the window specified by the hWnd parameter is not a system scroll bar control, the system sends the SBM_SETPOS message to the window to set scroll bar information. This allows SetScrollPos to operate on a custom control that mimics a scroll bar. If the window does not handle the SBM_SETPOS message, the SetScrollPos function fails.
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
See Also
GetScrollInfo , GetScrollPos , GetScrollRange , SetScrollInfo , SetScrollRange
==原始网址==http://msdn.microsoft.com/en-us/library/bb787597(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:25:45