Running a program in another?

I wrote a program in C ++. It just uses the console to make it as portable as possible. Unfortunately, many Windows users do not seem to understand how to use this program (Linux users are just fine) :). Therefore, I would like to write a graphical interface for this program. Since this needs to be run only for Windows, I would like to write it in C #.

But I want to keep the GUI separate from the original program. Basically, I need a way to include the compiled * .exe in another program. Is there a way to catch console output from another program and send data to it? Also, can I hide the console of the source program?

Related questions

How to run: Run command line in C #, get STD OUT results

+3
source share
5 answers

There are several ways to do this. The System.Diagnostics.Process class has methods that allow you to access the input and output of the application, you can automate it from there.

Basically, you can use the StandardInput and StandardOutput methods to get the output, and then interact with the inputs to control the application. Adding “similar questions” in addition to your question shows the first part of this part, the standard part of the output.

+1
source

, ++, ++. , # , , pInvoke DLL, GUI.

+1

0

(,/g) #, , . Win Form, . , .

0

, , , , , :

*.exe

You cannot do this. At best, you can create a library, as @Justin Ethier suggests, which both your GUI and command line tool rely on.

0
source

Source: https://habr.com/ru/post/1738685/


All Articles