3

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.

The Laggy Tablet
  • 100
  • 1
  • 12
  • 1
    [\[SO\]: How to create a Minimal, Reproducible Example (reprex (mcve))](https://stackoverflow.com/help/minimal-reproducible-example). Can you post your code to get an idea what's working and what's not? – CristiFati Feb 25 '21 at 09:05
  • I have no code, I don't know how I can do this. – The Laggy Tablet Feb 25 '21 at 15:09
  • Hmm, then some statements are misleading: "*I tried using PostMessage, SendInput and SendMessage but pywin32 uses virtual keycodes while ctypes does work*". – CristiFati Feb 25 '21 at 17:27
  • Well, I did write that code, but it does nothing related to *directinput* it uses vk – The Laggy Tablet Feb 25 '21 at 17:29
  • Then, you'd better post it here in order to reduce the chances of getting this question closed. Check [\[SO\]: How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) or [\[SO\]: How to create a Minimal, Reproducible Example (reprex (mcve))](https://stackoverflow.com/help/minimal-reproducible-example) for more asking related details. Otherwise you'll get lots of *-1* s. – CristiFati Mar 05 '21 at 03:58

1 Answers1

-1

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

Dharman
  • 30,962
  • 25
  • 85
  • 135
Michiel
  • 94
  • 5