I have a problem:

I need to run a console application (there are application sources) right in my written application and also need to be able to close it.

So, now in more detail:

Suppose we have the source code for a console application that can be launched from the console with parameters. I am writing my own, also a console, application, but it will not launch from the console, and so, how can I "sew" this application into my own so that I can both launch and close it, all from my application.

Solutions like "Use the already built application and CreateProcess with parameters" are not suitable.

  • What is the reason why something like CreateProcess doesn't work? - αλεχολυτ
  • The fact is that I need to integrate this application into my application and launch it from my application with my parameters. - Aleksei .C
  • @ Aleksei.C Do you decide what you need: run a third-party console application or embed the functionality of this application? If the latter, it is not clear what is bothering you, having all the samples in your hands. - zed
  • @zed. If you do not understand what exactly I need to do, please re-read. - Aleksei .C
  • @ Aleksei.C is not a reason, it is just a desire. But in general, there is nothing difficult to combine several sources into one project. Difficulties will begin when necessary initialization, the release of global resources. - αλεχολυτ

1 answer 1

Probably the easiest way is to rename the main () function of the application that needs to be "embedded" into any valid name and simply call this function with the necessary parameters.

  • Thanks, I'll try! - Aleksei .C