Synthesizing key events in windows

| tags: programming

For my video switch I want to be able to synthesize key events that look like they originated from the keyboard. The function SendInput in the user32.dll looks like the right low-level goods but Pete points out that the WScript.Shell has a SendKeys method that is easier to use. The Python code looks like:

import win32com.client
ws_shell = win32com.client.Dispatch("WScript.Shell")
SendKeys = ws_shell.SendKeys

DevGuru has a table of the key encodings.