Dev-Spot Developer Forums
September 08, 2010, 03:43:55 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the LearnCpp.com forums!  Enjoy your stay.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Program Launch  (Read 603 times)
BillK
Newbie
*
Posts: 1


View Profile
« on: February 25, 2010, 05:47:14 AM »

Is it possible in C++ to run a program that allows you to select an external EXE program and launch it and still be able to perform operations in the C++ program while the EXE is running?
Logged
Pintsize
Full Member
***
Posts: 113



View Profile
« Reply #1 on: February 25, 2010, 06:04:54 AM »

There are several ways (depending on what you want to achieve):
A common but limited one is to run the system() function with parameters separated by spaces as if you were running it from the command prompt:

Code:
system("application2.exe 42 24");

CreateProcess() is one of them
http://msdn.microsoft.com/en-us/library/ms682425.aspx

Shellexecute is a win32 api to handle this too:
http://msdn.microsoft.com/en-us/library/bb762153%28VS.85%29.aspx

try googling any of these:
execl, execlp, execv
Logged

Stroustrup's classic formulation: "C makes it easy for you to shoot yourself in the foot.  C++ makes that harder, but when you do, it blows away your whole leg."

How to ask questions the smart way
Theo
Global Moderator
Hero Member
*****
Posts: 521



View Profile
« Reply #2 on: February 27, 2010, 02:38:06 AM »

Interesting, I might need this in the future  Kiss
Logged

I will not give up on learning C++!!!
-_-.. Allegro vs SDL?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!