views:

165

answers:

1

We have some legacy software which depends on sending keystrokes to a DOS window and then scraping the screen. I am trying to re-create the software by redirecting the input and output streams of the process directly to my application. This part I have managed fine using:

_Process = new Process();
{
    _Process.StartInfo.FileName = APPLICATION;
    _Process.StartInfo.RedirectStandardOutput = true;
    _Process.StartInfo.RedirectStandardInput = true;
    _Process.StartInfo.RedirectStandardError = true;
    _Process.StartInfo.UseShellExecute = false;
    _Process.StartInfo.CreateNoWindow = true;
    _Process.OutputDataReceived += new DataReceivedEventHandler(_Process_OutputDataReceived);
    _Process.ErrorDataReceived += new DataReceivedEventHandler(_Process_ErrorDataReceived);
}

My problem is I need to send some command modifiers such as Ctrl, ALT and Space as well as F1-12 to this process but am unsure how. I can send basic text and I receive response's fine. I just need to emulate these modifiers.

A: 

Check out this table of key codes and see it you can send the two key codes and get them to work.

rerun