anatoly techtonik avatar anatoly techtonik committed 3f56b66

add necessary ctypes structures for processing input

Comments (0)

Files changed (1)

 # Constant for infinite timeout in WaitForMultipleObjects()
 INFINITE = -1
 
+# --- processing input structures -------------------------
+# INPUT_RECORD structure
+#  events:
+FOCUS_EVENT = 0x0010
+KEY_EVENT = 0x0001      # only key event is handled
+MENU_EVENT = 0x0008
+MOUSE_EVENT = 0x0002
+WINDOW_BUFFER_SIZE_EVENT = 0x0004
+#  records:
+class _uChar(ctypes.Union):
+  _fields_ = [('UnicodeChar', ctypes.wintypes.WCHAR),
+              ('AsciiChar', ctypes.wintypes.c_char)]
+class KEY_EVENT_RECORD(ctypes.Structure):
+  _fields_ = [
+    ('keyDown', ctypes.wintypes.BOOL),
+    ('repeatCount', ctypes.wintypes.WORD),
+    ('virtualKeyCode', ctypes.wintypes.WORD),
+    ('virtualScanCode', ctypes.wintypes.WORD),
+    ('char', _uChar),
+    ('controlKeyState', ctypes.wintypes.DWORD)]
+class _Event(ctypes.Union):
+  _fields_ = [('keyEvent', KEY_EVENT_RECORD)]
+  #  MOUSE_EVENT_RECORD        MouseEvent;
+  #  WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
+  #  MENU_EVENT_RECORD         MenuEvent;
+  #  FOCUS_EVENT_RECORD        FocusEvent;
+class INPUT_RECORD(ctypes.Structure):
+  _fields_ = [
+    ('eventType', ctypes.wintypes.WORD),
+    ('event', _Event)]
+# --- /processing input structures ------------------------
+
+
 
 np = subprocess.Popen([r"notepad"],
        stdin=subprocess.PIPE,
             print msvcrt.getch()
         continue
         """
+        # --- processing input ---------------------------
+        # --- /processing input --------------------------
 
     elif handles[ret] == nph:
         print("Notepad is closed. Exiting..")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.