这个函数怎么用_MouseClick
Func _MakeLong($LoWord, $HiWord)Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
Func _MouseClick($hWnd, $button, $x, $y, $times=1, $delay=250)
If $hWnd = 0 Then
SetError(-1)
Return
EndIf
Local $ix
Local $lParam = _MakeLong($x, $y)
Local $user32 = DllOpen("user32.dll")
$button = StringLower($button)
If $button = "left" Then
For $ix = 1 To $times
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam)
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x201, "int", 1, "long", $lParam)
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x202, "int", 0, "long", $lParam)
If $ix < $times Then Sleep($delay)
Next
ElseIf $button = "right" Then
For $ix = 1 To $times
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam)
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x204, "int", 2, "long", $lParam)
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x205, "int", 0, "long", $lParam)
If $ix < $times Then Sleep($delay)
Next
Else
SetError(-2)
If $user32 <> -1 Then DllClose($user32)
Return
EndIf
If $user32 <> -1 Then DllClose($user32)
EndFunc
帮忙看看 这个东西有没有问题呀,英文网上转来的,
为什么我怎么试都不成功? 都那么久了都没人解决啊... 函数调用?要达到什么效果? MouseClick的PostMessage版本把
_MouseClick(窗口句柄, 鼠标按钮, x, y,次数 , 延迟) 遇到了同样的问题
_MouseClickPlus
--------------------------------------------------------------------------------
发送一个鼠标动作到指定的窗口,不是非常准确,但是可以对最小化的窗口生效.
#Include <ACN_Mouse.au3>
_MouseClickPlus($Window[, $Button = "left"[, $X = ""[, $Y = ""[, $Clicks = 1]]]])
参数
$Window 要发送点击的窗口标题
$Button 要点击的按钮:"left"(左键),"right"(右键)
$X X 坐标
$Y Y 坐标
$Clicks 点击次数
返回值
注意/说明
您必须在MouseCoordMode 0的模式下使用才会正常.
相关
经测试无效...请教下这个应该如何解决呢? 你们这个函数哪里来的?帮助里没有啊。
楼上的,是不是忘了Opt("MouseCoordMode", 0) NND,经测试此函数没任何意义,因为它所需要的句柄不是窗体句柄,而是内部控件句柄,晕死,有ControlClick在,这个函数要来何用? 经测试:
#include <SendMessage.au3>
_SendMessage(ControlGetHandle("未命名","",""), 0x201, 1,_MakeLong(500, 500) )
Func _MakeLong($LoWord, $HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
向画图板发送一个鼠标点击,同理只能向控件发送点击,需要获得控件句柄
它等同于
Func _MakeLong($LoWord, $HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
; I = PostMessage(hwnd, WM_LBUTTONDOWN, 0, (mX And &HFFFF) + (mY And &HFFFF) * &H10000)
Func _MouseClick($hWnd, $button, $x, $y, $times=1, $delay=250)
If $hWnd = 0 Then
SetError(-1)
Return
EndIf
Local $ix
Local $lParam = _MakeLong($x, $y)
Local $user32 = DllOpen("user32.dll")
$button = StringLower($button)
If $button = "left" Then
For $ix = 1 To $times
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam)
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x201, "int", 1, "long", $lParam)
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x202, "int", 0, "long", $lParam)
; I = PostMessage(hwnd, WM_LBUTTONDOWN, 0, (mX And &HFFFF) + (mY And &HFFFF) * &H10000)
If $ix < $times Then Sleep($delay)
Next
ElseIf $button = "right" Then
For $ix = 1 To $times
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam)
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x204, "int", 2, "long", $lParam)
DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x205, "int", 0, "long", $lParam)
If $ix < $times Then Sleep($delay)
Next
Else
SetError(-2)
If $user32 <> -1 Then DllClose($user32)
Return
EndIf
If $user32 <> -1 Then DllClose($user32)
EndFunc
;'lp = Y * 65536 + X
_MouseClick(ControlGetHandle("未命名","",""), "left", 500,500) 你上面的那函数是把鼠标锁死的一般人很少用啊 回复 1# tenliq
_mouseclick这个函数帮助文档里没有啊
页:
[1]