[请问] 关于后台滚轮问题...

楼主: unlimit999 (黑先生)   2019-01-28 16:16:26
之前后台鼠标点击,我是用对岸论坛挖到的
https://bit.ly/2HBrqLR
里面有键盘和鼠标左右键点击功能,但没有鼠标滚轮的功能...
小弟我翻了一下代码,发现也不是很难
就是调用user32.dll里面的PostMessage函式来使用
于是我就依样画葫芦的抄一遍,稍微改点参数
;代替_WinAPI_PostMessage
Func _PostMessage($hWnd, $iMsg, $iwParam, $ilParam)
;$hWnd:控件标志
;$iMsg:发送送的消息
;$iwParam:消息讯息1
;$iwParam:消息讯息2
DllCall("user32.dll", "bool", "PostMessage", _
"hwnd", $hWnd, "uint", $iMsg, "wparam", $iwParam, "lparam", $ilParam)
EndFunc
Func _MouseWheel($hWnd, $x, $y, $botton= "up",$times= 1)
$ilParam= BitOR(BitAND($x,0xFFFF), $y*0x10000);座标转换成lParam识别值
$botton= StringLower($botton);统一转换成小写
Local $m= -1
If $botton= "up" Then
$m= 1
EndIf;判断滚轮往上or往下滚
For $i=1 To $times Step 1
_PostMessage($hWnd, 0x20a, 120*$m,$ilParam);0x20a表示滚轮滚动
Next
EndFunc
$hwnd= WinGetHandle("PostMessage_UDF.au3 - 记事本")
$hwnd= ControlGetHandle($hwnd, "","[Class: Edit]")
_MouseWheel($hwnd, 300, 300, "down",5)
可是怎么就没办法成功Orz
到底哪里出问题了?
作者: jamteam (生而为人)   2019-02-10 01:30:00
ControlClick,x845 y285,ahk_exe chrome.exe,,WheelUp这样试试看? 我用chrome可以用啊座标随便改

Links booklink

Contact Us: admin [ a t ] ucptt.com