本帖最后由 afan 于 2012-6-16 15:18 编辑
简单写了个,需要的自己测试#include <WinAPI.au3>
HotKeySet('^q', '_Exit') ;Ctrl - Q 退出
Global $iMouseDown, $handle, $hHook
$handle = DllCallbackRegister('_GetMouseEvent', 'int', 'int;ptr')
$hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($handle), _WinAPI_GetModuleHandle(0))
Local $iLD = 0, $iRD = 0
While 1
Sleep(1)
Switch $iMouseDown
Case 0
$iLD = 0
$iRD = 0
Case 1
$iLD = 1
Case 2
$iRD = 1
EndSwitch
If $iLD + $iRD = 2 Then MsgBox(64, '', '按下了鼠标左右键 ')
WEnd
Func _GetMouseEvent($1, $iwParam)
#forceref $1
Switch $iwParam
Case 0x0201 ;$WM_LBUTTONDOWN
$iMouseDown = 1
Case 0x0204 ;$WM_RBUTTONDOWN
$iMouseDown = 2
Case Else
$iMouseDown = 0
EndSwitch
EndFunc ;==>_GetMouseEvent
Func _Exit()
_WinAPI_UnhookWindowsHookEx($hHook)
DllCallbackFree($handle)
Exit
EndFunc ;==>_Exit
|