Click to See Complete Forum and Search --> : Calling another exe within a C# console application
sarathi_57
February 2nd, 2010, 07:44 AM
Hi,
I need to know how to call a exe within a C# console program.
I tried the other stuffs that just open the exe and give parameters as command line arguments.
But my problem is, the exe i try to open the exe, it opens a form which has few text boxes and check boxes.
is there a way to pass arguments to the text boxes and check boxes that i have in the another exe from the existing C# console application?
Please help me.
mariocatch
February 2nd, 2010, 09:21 AM
Your Form is still an exe that has a Program.cs that can take parameters. The Program.cs creates a new Form by calling the constructor. You can modify the constructor to take parameters that were received from the Program.cs entry point (Main).
From there you can auto-fill the textbox's with information.
Arjay
February 2nd, 2010, 11:19 AM
Just thought I'd mention... to do what mario has suggested will require that you modify the Form application.
nelo
February 2nd, 2010, 03:00 PM
Just thought I'd mention... to do what mario has suggested will require that you modify the Form application.
That's a good point. When I first saw the post I assumed that the source code for the target application was not available or that that application could not be changed.
sarathi_57
February 3rd, 2010, 12:58 AM
Sorry Friends!
I forgot to mention that i dont have the source code of the target exe that i am calling within the C# console application.
i am having the target exe alone which is openingthe form.
Now i need to pass input paramerters to the form that is opened.
Please help me
Sorry for not mentioning that i am not having the source code of the target exe
Arjay
February 3rd, 2010, 01:42 AM
Sorry Friends!
I forgot to mention that i dont have the source code of the target exe that i am calling within the C# console application.
i am having the target exe alone which is openingthe form.
Now i need to pass input paramerters to the form that is opened.
Please help me
Sorry for not mentioning that i am not having the source code of the target exeThen you simply can't do it. You can't pass command line params to an app and expect it to know what to do with the param if the app wasn't originally written to perform such behavior.
On the other hand you can simulate entering the data in the form through the UI. Search google for 'Active Accessibility'. What you would do is to start the exe, and then use AA to enter the data into the form.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.