Basically, I'm making a netsh GUI. What I need is simple:
Let's say I used
[code]shell("netsh int tcp show global")[/code]
and it produced an output, I want the output to be displayed in a RichTextBox.
How do I do that?
Thanks in advance.
Look into the Process class:
[url]http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[/url]
Then use ProcessStartInfo to redirect its output:
[url]http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx[/url]
Any way to do this but with C++?
The only way i do it is to print to a file and then read from a file which i think is kind of a derpy way to do it.
[QUOTE=Corewarp3;22663106]Any way to do this but with C++?
The only way i do it is to print to a file and then read from a file which i think is kind of a derpy way to do it.[/QUOTE]
Amazing thing about .NET is you have reflector so you can see how anything in .NET is done.
[code]if (startInfo.RedirectStandardOutput)
{
this.CreatePipe(out handle4, out lpStartupInfo.hStdOutput, false);
}
this.standardOutput = new StreamReader(new FileStream(handle4, FileAccess.Read, 0x1000, false), encoding, true, 0x1000);
[/code]
So it creates a pipe and passes its handle to the process and then it reads from the pipe using a filestream.
Using the information from it though you can google hStdOutput and find
[url]http://support.microsoft.com/kb/190351[/url]
Sorry, you need to Log In to post a reply to this thread.