I'm trying to get Mouse Double Clicks with pyHook, but instead I'm getting two pair entries of single clicks e.g. WM_LBUTTONDOWN (0x201) and WM_LBUTTONUP (0x202) . I'm expecting WM_LBUTTONDBLCLK (0x203). What am I misssing here?
import pythoncom, pyHook
def OnMouseEvent(event):
print event.Message, event.Position
return True
hm = pyHook.HookManager()
hm.MouseAll = OnMouseEvent
hm.HookMouse()
pythoncom.PumpMessages()
I've found this hint: In this post MrZebra says: "For this (0x203) to be sent, your window class needs to be created with the CS_DBLCLKS class style"
Edit: This page indicates that doubleclicking will generate these 4 msgs: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP, but I actually get the first two twice.
I'm using Python 2.7 and pyHook 1.5.1 on Win7x64
ReEdit: I'll consider as answers C++/C# Keyboard/Mouse hooks alternatives. On the other hand, I'm not sure if it is a common practice to build functions to determine the double click event evaluating the time between two clicks.