I've seen a C# example using ConsoleRead API function but when I've tried to translate it to VBNET I get a lots of errors, also in other sites like pinvoke the unique example is for C# too, I can't find any good information for VBNET of ConsoleRead API function (if exist a way to read the console buffer without APIS then I get no idea).
Also I've tried this console buffer reader Class for VBNET (http://pastebin.com/XYxakDTV) but it throws an unhandled exception with message like this "Controller not valid".
Someone could illustrate me and all other people with an example for VBNET of how to launch a process from a GUI app (WindowsForm) to read the console output to retrieve characters/strings?
UPDATE:
I'm not sure but I think that a launched process (using System.Process Class) does not assign the console to the app so I think that all the examples seen here in MSDN could not help me: http://msdn.microsoft.com/en-us/library/system.console.aspx
Use
I think that the answer is the same as for your other question Run a commandline process and get the output while that process still running?
Edit you are asking for an form application to read console output. So let's have a console application ():
It generates a space separated numbers one per second. Now the forms application. Let's have a form with a multiline
TextBox
namedtxtResult
and abutton
cmdStart
:It writes the numbers to the TextBox one per a line. There is no API magic but it works.