0

I start a new process using

Process reprocessor = Process.Start(@"C:\Scripts\Tools\Reprocessor\reprocessor.exe");

I then wait for that process to load its window:

do // Wait for process to open
{
    processes = Process.GetProcessesByName("reprocessor");    
    Thread.Sleep(1000);
}
while (processes.Length == 0);

My question is, how can I send keyboard input to that process? Such as cntl, tabs and numbers.

I have been investigating SendMessage but I have basically got no where with it and I'm not even sure it is ther right approach.

The process is a closed source application. Likely written in .net winforms etc but it is a black box to me.

gclark18
  • 659
  • 6
  • 23
  • [How to use SendInput to simulate the UP arrow key press (or other extended keys)](https://stackoverflow.com/a/71589883/7444103) -- Note that the code you find there is designed to send inputs to a windowed app. Still works with a Console app, of course, but `AttachThreadInput()` and `SetFocus()` fail with a Console window, so adapt the code to avoid forcibly failing when those functions return `false`. `RestoreWindow()` and `BringWindowToTop()` do work. – Jimi Aug 31 '22 at 15:39
  • Also, note that there's a sample Solution you can download for testing. – Jimi Aug 31 '22 at 15:44
  • Google "c# system.windows.automation tutorial" to get ahead. – Hans Passant Aug 31 '22 at 17:04
  • I have had a look and I think I need an example to get me started @HansPassant – gclark18 Aug 31 '22 at 20:32

0 Answers0