Reputation: 2696
I am developing an windows form application for some internal working.After building this application i need to call this exe file from another application. And need to get the process response. So can any one tell me how can i return some values from an application and how can i read that response in another application from where first application executed.
Upvotes: 0
Views: 326
Reputation: 35380
If this is a command-line application, you can read input data using command-line arguments and send out response on standard output device.
If it is a Windows application, you can use named pipes or WCF etc. If that's complicated, you can simply write output to a log file and then read that file from other applications.
Upvotes: 1
Reputation: 7197
easy use:
http://msdn.microsoft.com/en-us/library/system.environment.exit.aspx
Environment.Exit(codetoreturn);
Use a non-zero number to indicate an error. In your application, you can define your own error codes in an enumeration, and return the appropriate error code based on the scenario. For example, return a value of 1 to indicate that the required file is not present and a value of 2 to indicate that the file is in the wrong format. For a list of exit codes used by the Windows operating system, see System Error Codes in the Windows documentation.
Upvotes: 0