|
楼主,你给的那个地址中已经将例子写的很清楚了.
Const GWL_WNDPROC = (-4)
Const WM_COMMAND = &H111
Const WM_MBUTTONDOWN = &H207
Const WM_MBUTTONUP = &H208
Const WM_MOUSEWHEEL = &H20A
dim Oldwinproc As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Function FlexScroll(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'支持滚轮的滚动 Yu 2004-5-10 15:33
Select Case wMsg
Case WM_MOUSEWHEEL
Select Case wParam
Case -7864320 '向下滚
SendKeys "{PGDN}"
Case 7864320 '向上滚
SendKeys "{PGUP}"
End Select
End Select
FlexScroll = CallWindowProc(Oldwinproc, hWnd, wMsg, wParam, lParam)
End Function
以下给你的参考意见:
注意看下定义常量部份与声明的外部WINDOWS的API库文件user32 ,然后是声明库文件中的相关WINDOWS底层API函数。比如SetWindowLong函数。
如果你有了Win32_API.sbh文件的话,你的Declare Function SetWindowLong Lib…… 外部库文件声明代码即可不用在脚本中进行声明。而可以在脚本头一行用'$include 将Win32_API.sbh库声明文件包含进来。你的Win32_API.sbh文件实际上是Windows的底层API库声明文件。其中已经包含了必要的外部文件API的所有声明。这几句话请楼主好好去理解下。然后仔细的看下你的Win32_API.sbh文件的具体内容,搞清楚在robot中sbh和sbl两种库文件的关系。这种实现方法最终都是通过WINDOWS底层API提供的接口(库声明文件中声明的)以调用底层API来实现的。
至于你的图片验证点。你可以验证一个较小范围。不容易改变的区域。或者通过验证点中的蒙板工具将不确定的部份模糊验证。 |
|