How can I send a keystroke to a hidden window?
<p>I create a hidden window process for CMD.EXE like so:</p>

<pre><code>        //  Create the process start window.
        var processStartInfo = new ProcessStartInfo("cmd.exe", null);

        //  Set the options.
        processStartInfo.UseShellExecute = false;
        processStartInfo.ErrorDialog = false;
        processStartInfo.CreateNoWindow = true;
        processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;

        //  Specify redirection.
        processStartInfo.RedirectStandardError = true;
        processStartInfo.RedirectStandardInput = true;
        processStartInfo.RedirectStandardOutput = true;

        //  Create the process.
        currentProcess = new Process();
</code></pre>

<p>I then handle all input/output myself through redirected streams. However, I want 'tab' to show the auto-completion data. I have tried sending '\t' to the input stream - no joy. If the window is made visible I have the window handle in the process structure and can set it to the foreground and use 'SendKeys'. This is not acceptable though, as I need the window to be invisible.</p>

<p>So does anyone know how to send a keystroke to a process ID?</p>

<p>Thanks in advance!</p>
