This last answer (user7711283) is working under windows with a minor fix:
class RAWMOUSE(ctypes.Structure):
_fields_ = [
("usFlags", ctypes.c_ushort),
#("ulButtons", ctypes.c_ulong),
("usButtonFlags", ctypes.c_ushort),
("usButtonData", ctypes.c_ushort),
("ulRawButtons", ctypes.c_ulong),
("lLastX", ctypes.c_long),
("lLastY", ctypes.c_long),
("ulExtraInformation", ctypes.c_ulong)
]
Indeed, as the struct is a union, you need to comment either "usButtons" or both "usButtonData" and "usButtonFlags"