Run a console application from a form application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello there

how do i set up a window menu in a window application to run a console application
 
Emmanouel said:
Hello there,

how do i set up a window menu in a window application to run a console application?

Add a MainMenu control to the form using the Toolbox and for running an
application do
Process::Start(S"myconsoleapp.exe");
 
Thanks michiel for the reply,

Meanwhile i found more options as to how to run an exe from my form .....

That is , there is WinExec, CreateProcess and Process::Start that all can run an exe from my application.

Can anyone tell me the best way or which one of the above is the best.....

I would like to run the exe in the background, without interfering with the form of the application. The background process creates a file that would be used by the windows application.
 
Personally, I'd use Process:Start to make the code as managed as possible.
One of it's implementations uses the ProcessStartInfo structure, which has
various interesting properties such as CreateNoWindow that'd satisfy your
goals.

Emmanouel said:
Thanks michiel for the reply,

Meanwhile i found more options as to how to run an exe from my form .....

That is , there is WinExec, CreateProcess and Process::Start that all can
run an exe from my application.
Can anyone tell me the best way or which one of the above is the best.....

I would like to run the exe in the background, without interfering with
the form of the application. The background process creates a file that
would be used by the windows application.
 
Thanks michiel

I also used Process:close to free up resources when the process ended.

Thank you again
 
Back
Top