Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: How to interact with inactive window?

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?

like image 449
Andreas Zita Avatar asked Nov 14 '22 00:11

Andreas Zita


1 Answers

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."

like image 183
Sogger Avatar answered Dec 21 '22 23:12

Sogger