作者unlimit999 (黑先生)
看板EzHotKey
标题[请问] 关於後台滚轮问题...
时间Mon Jan 28 16:16:26 2019
之前後台滑鼠点击,我是用对岸论坛挖到的
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
到底哪里出问题了?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 180.176.175.103
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/EzHotKey/M.1548663389.A.F49.html
※ 编辑: unlimit999 (180.176.175.103), 01/28/2019 16:19:20
1F:推 jamteam: ControlClick,x845 y285,ahk_exe chrome.exe,,WheelUp 02/10 01:30
2F:→ jamteam: 这样试试看? 我用chrome可以用啊 02/10 01:30
3F:→ jamteam: 座标随便改 02/10 01:30