5

Is it possible to interact with an inactive window from another window? I want to focus a textbox in a window without making it active, and then send keystrokes and mouse events to it. It seem to be possible to send messages to inactive windows using SendMessage but could it be possible to also focus a textbox in the window and send keystrokes to it, without ever making the window active?

Andreas Zita
  • 7,232
  • 6
  • 54
  • 115

2 Answers2

1

Have a look at the same question worded a little different here

Quote @Kevin Montrose: "Windows assumes that the activate window is the one getting keyboard input. The proper way to fake keyboard input is with SendInput, and you'll notice that it sends messages to the active window only."

Community
  • 1
  • 1
Sogger
  • 15,962
  • 6
  • 43
  • 40
0

Did you have a look at UI Automation?

Getting a pattern and invoking it isn't that hard. The only thing I am not sure about is whether or not the window will get the focus.

Of course this will only work in the same process.

Emond
  • 50,210
  • 11
  • 84
  • 115