发现一个解决办法,但是可能会导致电脑比较卡,链接在这里:http://www.autoitx.com/forum.php ... hlight=%CA%F3%B1%EA
_MouseSetOnEvent() - 鼠标版的 HotKeySet
语法:
_MouseSetOnEvent($EVENT [, "FuncName" [, $sParam1 [, $sParam2]]])
如果"FuncName"是空字符串(""),函数将不会设置 $EVENT.
例子:
#include <MouseSetOnEvent_UDF.au3>
;当接收到左键按下的消息后,屏蔽左键按下事件,调用我们自己的函数MousePrimaryDown_Event
_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "MousePrimaryDown_Event")
Sleep(5000)
_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT)
MsgBox(64, "注意!", "现在我们屏蔽了右键弹起,并且当鼠标键弹起时调用我们的函数。", 5)
;当接收到右键弹起的消息后,屏蔽邮件弹起事件,调用我们自己的函数MouseSecondaryUp_Event
_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "MouseSecondaryUp_Event")
Sleep(5000)
_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT)
Func MousePrimaryDown_Event()
ConsoleWrite("Primary Mouse Down" & @LF)
EndFunc
Func MouseSecondaryUp_Event()
ConsoleWrite("Secondar Mouse Up" & @LF)
EndFunc
可用的事件常量:
$MOUSE_MOVE_EVENT - 鼠标移动
$MOUSE_PRIMARYDOWN_EVENT - 左键按下
$MOUSE_PRIMARYUP_EVENT - 左键弹起
$MOUSE_SECONDARYDOWN_EVENT - 右键按下
$MOUSE_SECONDARYUP_EVENT - 右键弹起
$MOUSE_WHELLDOWN_EVENT - 滚轮按下
$MOUSE_WHELLUP_EVENT - 滚轮弹起
$MOUSE_WHELLSCROLL_EVENT - 滚轮滚动
$MOUSE_EXTRABUTTONDOWN_EVENT - 侧键按下(通常是前进、后退的导航键,比如双飞燕 4D++ OP- 35)$MOUSE_EXTRABUTTONUP_EVENT - 侧键弹起
来源:http://www.autoitscript.com/forum/index.php?showtopic=64738
缺点:无法响应双击事件…… |