The Laggy Tablet
The Laggy Tablet

Reputation: 100

How to send DirectInput keys to an inactive window in Python

I would like to send DirectInput keys to an inactive window without interfering with my actual mouse. I tried using PostMessage, SendInput and SendMessage but pywin32 uses virtual keycodes while ctypes does work with DirectInput. I have no idea how I can make it send in an inactive window.

Upvotes: 3

Views: 1329

Answers (1)

Michiel
Michiel

Reputation: 94

Try using this, it manages to work for me send the keystrokes to the inactive window,

Use (but add error checking) hwndMain = win32gui.FindWindow("notepad", "​prueba.txt: log keys") hwndEdit = win32gui.FindWindowEx

Upvotes: -1

Related Questions