PyHook3函数大全

'''
HookEvent
Instance Methods
string GetMessageName(self) Returns: Name of the event
Class Variables
MessageName
Instance Variables
integer Message Keyboard or mouse event message
integer Time Seconds since the epoch when the even current
integer Window Window handle of the foreground window at the time of the event
string WindowName Name of the foreground window at the time of the event
'''
'''
KeyboardEvent
Instance Methods
string GetKey(self) Returns: Name of the virtual keycode
boolean IsExtended(self) Returns: Is this an extended key?
boolean IsInjected(self) Returns: Was this event generated programmatically?
boolean IsAlt(self) Returns: Was the alt key depressed?
boolean IsTransition(self) Returns: Is this a transition from up to down or vice versa?
Class Variables
Key = property(fget= GetKey)
Extended = property(fget= IsExtended)
Injected = property(fget= IsInjected)
Alt = property(fget= IsAlt)
Transition = property(fget= IsTransition)
Instance Variables
string Ascii ASCII value, if one exists
integer KeyID Virtual key code
integer ScanCode Scan code
'''
'''
MouseEvent
Instance Variables
boolean Injected Was this event generated programmatically?
2-tuple of integer Position Location of the mouse event on the screen
integer Wheel Positive if the wheel scrolls up, negative if down, zero otherwise
'''
'''
HookManager
Instance Methods
HookMouse(self) Begins watching for mouse events.
UnhookMouse(self) Stops watching for mouse events.
HookKeyboard(self) Begins watching for keyboard events.
UnhookKeyboard(self) Stops watching for keyboard events.

MouseSwitch(self, msg, x, y, data, flags, time, hwnd, window_name) Passes a mouse event on to the appropriate handler if one is registered.
KeyboardSwitch(self, msg, vk_code, scan_code, ascii, flags, time, hwnd, win_name) Passes a keyboard event on to the appropriate handler if one is registered.
connect(self, switch, id, func) Registers a callback to the given function for the event with the given ID in the provided dictionary.
disconnect(self, switch, id) Unregisters a callback for the event with the given ID in the provided dictionary.

SubscribeMouseMove(self, func) Registers the given function as the callback for this mouse event type.

SubscribeMouseLeftDown(self, func) Registers the given function as the callback for this mouse event type.
SubscribeMouseLeftUp(self, func) Registers the given function as the callback for this mouse event type.
SubscribeMouseLeftDbl(self, func) Registers the given function as the callback for this mouse event type.

SubscribeMouseRightDown(self, func) Registers the given function as the callback for this mouse event type.
SubscribeMouseRightUp(self, func) Registers the given function as the callback for this mouse event type.
SubscribeMouseRightDbl(self, func) Registers the given function as the callback for this mouse event type.

SubscribeMouseMiddleDown(self, func) Registers the given function as the callback for this mouse event type.
SubscribeMouseMiddleUp(self, func) Registers the given function as the callback for this mouse event type.
SubscribeMouseMiddleDbl(self, func) Registers the given function as the callback for this mouse event type.

SubscribeMouseWheel(self, func) Registers the given function as the callback for this mouse event type.

SubscribeMouseAll(self, func) Registers the given function as the callback for all mouse events.

SubscribeMouseAllButtons(self, func) Registers the given function as the callback for all mouse button events.
SubscribeMouseAllButtonsDown(self, func) Registers the given function as the callback for all mouse button down events.
SubscribeMouseAllButtonsUp(self, func) Registers the given function as the callback for all mouse button up events.
SubscribeMouseAllButtonsDbl(self, func) Registers the given function as the callback for all mouse button double click events.

SubscribeKeyDown(self, func) Registers the given function as the callback for this keyboard event type.
SubscribeKeyUp(self, func) Registers the given function as the callback for this keyboard event type.
SubscribeKeyChar(self, func) Registers the given function as the callback for this keyboard event type.

SubscribeKeyAll(self, func) Registers the given function as the callback for all keyboard events.

Class Variables
MouseMove = property(fset= SubscribeMouseMove)
MouseLeftDown = property(fset= SubscribeMouseLeftDown)
MouseLeftUp = property(fset= SubscribeMouseLeftUp)
MouseLeftDbl = property(fset= SubscribeMouseLeftDbl)

MouseRightDown = property(fset= SubscribeMouseRightDown)
MouseRightUp = property(fset= SubscribeMouseRightUp)
MouseRightDbl = property(fset= SubscribeMouseRightDbl)

MouseMiddleDown = property(fset= SubscribeMouseMiddleDown)
MouseMiddleUp = property(fset= SubscribeMouseMiddleUp)
MouseMiddleDbl = property(fset= SubscribeMouseMiddleDbl)

MouseWheel = property(fset= SubscribeMouseWheel)

MouseAll = property(fset= SubscribeMouseAll)

MouseAllButtons = property(fset= SubscribeMouseAllButtons)
MouseAllButtonsDown = property(fset= SubscribeMouseAllButtonsD...
MouseAllButtonsUp = property(fset= SubscribeMouseAllButtonsUp)
MouseAllButtonsDbl = property(fset= SubscribeMouseAllButtonsDbl)

KeyDown = property(fset= SubscribeKeyDown)
KeyUp = property(fset= SubscribeKeyUp)
KeyChar = property(fset= SubscribeKeyChar)

KeyAll = property(fset= SubscribeKeyAll)
'''
'''
Class HookConstants
string MsgToName(cls, msg) Class method.
string IDToName(cls, code) Class method.
integer VKeyToID(cls, vkey) Class method.

Class Variables
WH_MIN = -1
WH_MSGFILTER = -1
WH_JOURNALRECORD = 0
WH_JOURNALPLAYBACK = 1
WH_KEYBOARD = 2
WH_GETMESSAGE = 3
WH_CALLWNDPROC = 4
WH_CBT = 5
WH_SYSMSGFILTER = 6
WH_MOUSE = 7
WH_HARDWARE = 8
WH_DEBUG = 9
WH_SHELL = 10
WH_FOREGROUNDIDLE = 11
WH_CALLWNDPROCRET = 12
WH_KEYBOARD_LL = 13
WH_MOUSE_LL = 14
WH_MAX = 15
WM_MOUSEFIRST = 0x0200
WM_MOUSEMOVE = 0x0200
WM_LBUTTONDOWN = 0x0201
WM_LBUTTONUP = 0x0202
WM_LBUTTONDBLCLK = 0x0203
WM_RBUTTONDOWN = 0x0204
WM_RBUTTONUP = 0x0205
WM_RBUTTONDBLCLK = 0x0206
WM_MBUTTONDOWN = 0x0207
WM_MBUTTONUP = 0x0208
WM_MBUTTONDBLCLK = 0x0209
WM_MOUSEWHEEL = 0x020A
WM_MOUSELAST = 0x020A
WM_KEYFIRST = 0x0100
WM_KEYDOWN = 0x0100
WM_KEYUP = 0x0101
WM_CHAR = 0x0102
WM_DEADCHAR = 0x0103
WM_SYSKEYDOWN = 0x0104
WM_SYSKEYUP = 0x0105
WM_SYSCHAR = 0x0106
WM_SYSDEADCHAR = 0x0107
WM_KEYLAST = 0x0108
vk_to_id = {'VK_LBUTTON': 0x01, 'VK_RBUTTON': 0x02, 'VK_CANCEL...
id_to_vk = dict([(v, k) for k, v in vk_to_id.items()])
msg_to_name = {WM_MOUSEMOVE: 'mouse move', WM_LBUTTONDOWN: 'mo...
'''

posted on 2022-08-03 14:19  帅胡  阅读(197)  评论(0编辑  收藏  举报

导航