Console app showing message box on error

Posted by holz on Stack Overflow See other posts from Stack Overflow or by holz
Published on 2010-04-01T01:19:18Z Indexed on 2010/04/01 1:23 UTC
Read the original article Hit count: 331

I am trying to integrate with a vendors app by calling it with command args from c#. It is meant to automate a process that we need to do with out needing anyone to interact with the application. If there are no errors when running the process it works fine.

However if there are any errors the vendors application will show a message box with the error code and error message and wait for someone to click the ok button. When the ok button is clicked it will exit the application returning the error code as the exit code.

As my application is going to be a windows service on a server, needing someone to click an okay button will be an issue. Just wondering what the best solution would be to get around this.

My code calling the vendor app is...

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "someapp.exe"
startInfo.Arguments = "somefile.txt";

Process jobProcess = Process.Start(startInfo);
jobProcess.WaitForExit();

int exitCode = jobProcess.ExitCode;

© Stack Overflow or respective owner

Related posts about console-application

Related posts about c#