-
September 8th, 2011, 12:55 AM
#1
Capture console output from process created in DLL
Hi,
I am working on method in a DLL that gets called by another application. In my method I have been writing to the event log to aid debugging and generally to allow me to determine whether things are working. However, in this method I create a process and run another application and I want to be able to capture the output of the application and write it to the eventlog.
Code:
Process getNextIons = new Process();
getNextIons.StartInfo.FileName = @"""C:\Program Files\OpenMS-1.6\PrecursorIonSelector.exe""";
getNextIons.StartInfo.Arguments = @"-ini ""C:\Program Files\OpenMS-1.6\precursorionselector.ini""";
getNextIons.StartInfo.UseShellExecute = false;
getNextIons.StartInfo.RedirectStandardOutput = true;
getNextIons.Start();
getNextIons.WaitForExit();
System.Diagnostics.EventLog.WriteEntry("FMANWiff", "IPS: " + getNextIons.StandardOutput.ReadToEnd());
I have a console test application that calls my method and when I do this I am able to see the relevant entries in my event log. However when I actually try to make use of the DLL, not using the test application, all I end up seeing is an entry:
IPS:
and none of the output. I can tell it is running however as I can see a number of output files being updated.
Does anyone know why I am not getting any output and how I can rectify this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|