|
#Include <WinAPI.au3>
;#include <WindowsConstants.au3>
Global Const $WM_MOUSEMOVE = 0x0200
Global Const $WM_LBUTTONDOWN = 0x0201
Global Const $WM_LBUTTONUP = 0x0202
Global Const $WM_LBUTTONDBLCLK = 0x0203
Global Const $WM_RBUTTONDOWN = 0x0204
Global Const $WM_RBUTTONUP = 0x0205
Global Const $WM_RBUTTONDBLCK = 0x0206
Global Const $WM_MBUTTONDOWN = 0x0207
Global Const $WM_MBUTTONUP = 0x0208
Global Const $WM_MBUTTONDBLCK = 0x0209
Global Const $WM_MOUSEWHEEL = 0x020A
Global Const $WM_XBUTTONDOWN = 0x020B
Global Const $WM_XBUTTONUP = 0x020C
Global Const $WM_XBUTTONDBLCLK = 0x020D
Global Const $WM_MOUSEHWHEEL = 0x020E
Global $LeftTime=0 ,$iFirstLeftClick=0,$bDbClk=False
Local $DefMouseSet=RegRead("HKEY_USERS\S-1-5-21-776561741-492894223-1417001333-500\Control Panel\Mouse","DoubleClickSpeed")
While 1
Global $_endmouse=""
$_whand = DllCallbackRegister("_Mouse_Events_Handler", "int", "int;ptr;ptr")
$_whmod = _WinAPI_GetModuleHandle(0)
$_whook=_WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($_whand),$_whmod)
$mouse = _waitmouse()
;Switch $mouse
; Case 1
; If $LeftTime=0 Then $iFirstLeftClick=TimerInit()
; $LeftTime+=1
; If $LeftTime=2 And Int(TimerDiff($iFirstLeftClick))< $DefMouseSet Then $bDbClk=True
;If $LeftTime =2 Then $LeftTime=0
; Case 2
; MsgBox(64,"","按下鼠标右键")
; Case 3
; MsgBox(64,"","按下鼠标中键")
;Case 4
; MsgBox(64,"","鼠标轮转动")
;EndSwitch
WEnd
Func _waitmouse()
While 1
Sleep(1)
If Not $_endmouse="" Then
_WinAPI_UnhookWindowsHookEx($_whook)
DllCallbackFree($_whand)
Return $_endmouse
EndIf
WEnd
EndFunc
Func _Mouse_Events_Handler($wnCode, $wwParam, $wlParam)
Switch $wwParam
Case $WM_LBUTTONUP ;按下鼠标左键
If $LeftTime=0 Then $iFirstLeftClick=TimerInit()
$LeftTime+=1
If $LeftTime=2 And Int(TimerDiff($iFirstLeftClick))< $DefMouseSet Then
ConsoleWrite("DbClk")
$LeftTime=0
Return True; ///////////////////钩子教程上说,直接返回TRUE,就能丢弃并阻止该消息的传递,为什么不行呢?
EndIf
;If $LeftTime =2 Then $LeftTime=0
;$_endmouse = 1
; Case $WM_RBUTTONDOWN ;按下鼠标右键
; $_endmouse = 2
;Case $WM_MBUTTONDOWN ;按下鼠标中键
; $_endmouse = 3
;Case $WM_MOUSEWHEEL ;鼠标轮转动
; $_endmouse = 4
;Case $WM_LBUTTONDBLCLK
; $_endmouse = 15
EndSwitch
EndFunc
我的目的是捕获鼠标双击桌面快捷方式时,取得双击的文件名和参数,如果符合规则则放行,否则阻止执行并弹出一个消息框,可是连阻止传递这关都过不了,请大家帮忙, |
|