Package pyhook :: Module HookManager :: Class HookConstants
[hide private]
[frames] | no frames]

Class HookConstants

source code

Stores internal windows hook constants including hook types, mappings from virtual keycode name to value and value to name, and event type value to name.

Class Methods [hide private]
string
MsgToName(cls, msg)
Class method.
source code
string
IDToName(cls, code)
Class method.
source code
integer
VKeyToID(cls, vkey)
Class method.
source code
Class Variables [hide private]
  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...
Method Details [hide private]

MsgToName(cls, msg)
Class Method

source code 

Class method. Converts a message value to message name.

Parameters:
  • msg (integer) - Keyboard or mouse event message
Returns: string
Name of the event

IDToName(cls, code)
Class Method

source code 

Class method. Gets the keycode name for the given value.

Parameters:
  • code (integer) - Virtual keycode value
Returns: string
Virtual keycode name

VKeyToID(cls, vkey)
Class Method

source code 

Class method. Converts a virtual keycode name to its value.

Parameters:
  • vkey (string) - Virtual keycode name
Returns: integer
Virtual keycode value

Class Variable Details [hide private]

vk_to_id

Value:
{'VK_LBUTTON': 0x01, 'VK_RBUTTON': 0x02, 'VK_CANCEL': 0x03, 'VK_MBUTTO\
N': 0x04, 'VK_BACK': 0x08, 'VK_TAB': 0x09, 'VK_CLEAR': 0x0C, 'VK_RETUR\
N': 0x0D, 'VK_SHIFT': 0x10, 'VK_CONTROL': 0x11, 'VK_MENU': 0x12, 'VK_P\
AUSE': 0x13, 'VK_CAPITAL': 0x14, 'VK_KANA': 0x15, 'VK_HANGEUL': 0x15, \
'VK_HANGUL': 0x15, 'VK_JUNJA': 0x17, 'VK_FINAL': 0x18, 'VK_HANJA': 0x1\
9, 'VK_KANJI': 0x19, 'VK_ESCAPE': 0x1B, 'VK_CONVERT': 0x1C, 'VK_NONCON\
VERT': 0x1D, 'VK_ACCEPT': 0x1E, 'VK_MODECHANGE': 0x1F, 'VK_SPACE': 0x2\
0, 'VK_PRIOR': 0x21, 'VK_NEXT': 0x22, 'VK_END': 0x23, 'VK_HOME': 0x24,\
...

msg_to_name

Value:
{WM_MOUSEMOVE: 'mouse move', WM_LBUTTONDOWN: 'mouse left down', WM_LBU\
TTONUP: 'mouse left up', WM_LBUTTONDBLCLK: 'mouse left double', WM_RBU\
TTONDOWN: 'mouse right down', WM_RBUTTONUP: 'mouse right up', WM_RBUTT\
ONDBLCLK: 'mouse right double', WM_MBUTTONDOWN: 'mouse middle down', W\
M_MBUTTONUP: 'mouse middle up', WM_MBUTTONDBLCLK: 'mouse middle double\
', WM_MOUSEWHEEL: 'mouse wheel', WM_KEYDOWN: 'key down', WM_KEYUP: 'ke\
y up', WM_CHAR: 'key char', WM_DEADCHAR: 'key dead char', WM_SYSKEYDOW\
N: 'key sys down', WM_SYSKEYUP: 'key sys up', WM_SYSCHAR: 'key sys cha\
...