[請問] 關於後台滾輪問題...

作者: 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