CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2010
    Posts
    2

    Calling another exe within a C# console application

    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.

  2. #2
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    Re: Calling another exe within a C# console application

    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.

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Calling another exe within a C# console application

    Just thought I'd mention... to do what mario has suggested will require that you modify the Form application.

  4. #4
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Calling another exe within a C# console application

    Quote Originally Posted by Arjay View Post
    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.

  5. #5
    Join Date
    Feb 2010
    Posts
    2

    Re: Calling another exe within a C# console application

    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

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Calling another exe within a C# console application

    Quote Originally Posted by sarathi_57 View Post
    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
    Then 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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured