Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Okay here the solution...</p> <p>Variables needed:</p> <pre><code>Private process As System.Diagnostics.Process Private threadOut As Thread Private streamOut As System.IO.StreamReader Private threadErr As Thread Private streamErr As System.IO.StreamReader Private threadIn As Thread Private streamIn As System.IO.StreamWriter </code></pre> <p>Subs needed:</p> <pre><code>Private Sub ThreadTaskOut() Dim line While Not process.HasExited line = streamOut.ReadToEnd If line &lt;&gt; Nothing And line &lt;&gt; "" Then log("Out: " &amp; line) Console.Out.Write(line) End If End While End Sub Private Sub ThreadTaskErr() Dim line While Not process.HasExited line = streamErr.ReadToEnd If line &lt;&gt; Nothing And line &lt;&gt; "" Then log("Err: " &amp; line) Console.Error.Write(line) End If End While End Sub Private Sub ThreadTaskIn() Dim line While Not process.HasExited line = Console.In.ReadLine If line &lt;&gt; Nothing And line &lt;&gt; "" Then log("In: " &amp; line) streamIn.WriteLine(line) End If End While End Sub </code></pre> <p>Inside main:</p> <pre><code> ' create process information Dim p As New ProcessStartInfo p.FileName = execute p.Arguments = Command() p.UseShellExecute = False p.CreateNoWindow = True p.RedirectStandardInput = True p.RedirectStandardError = True p.RedirectStandardOutput = True ' log process start log("Execute: " &amp; execute &amp; " " &amp; Command()) ' start process process = Diagnostics.Process.Start(p) ' start thread for output stream streamOut = process.StandardOutput threadOut = New Thread(AddressOf ThreadTaskOut) threadOut.IsBackground = True threadOut.Start() ' start thread for error stream streamErr = process.StandardError threadErr = New Thread(AddressOf ThreadTaskErr) threadErr.IsBackground = True threadErr.Start() ' start thread for input stream streamIn = process.StandardInput threadIn = New Thread(AddressOf ThreadTaskIn) threadIn.IsBackground = True threadIn.Start() ' wait for the process to finish process.WaitForExit() </code></pre> <p>log is another sub to log to file, execute is the variable holding the _someApp.exe frommy initial post. I still don't know if the console to inputstream thread dows it right, because my wrapped app had no input as it seems. May someone spotts an error...</p> <p>For my purposes, hmm it works like I need it</p> <p>Greetz, GHad</p> <p>Code inside main</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload