system() call in win32 c++ app

G

Guest

When using the function system() in a win32 c++ application, i notice a
seperate shell window opens and closes quickly when the app is run and this
system() call is encountered. Is there a way to suppress or prevent this
seperate shell window from opening or being seen ?

ex:
int result = system("some_other_app.exe arg1 arg2");
 
N

Nathan Mates

When using the function system() in a win32 c++ application, i notice a
seperate shell window opens and closes quickly when the app is run and this
system() call is encountered. Is there a way to suppress or prevent this
seperate shell window from opening or being seen ?

Look up _spawnlp (and cousins) in MSDN, such as
http://msdn2.microsoft.com/en-gb/library/t7y6z6fd(VS.80).aspx .
Basically, do something like

_spawnlp(_P_NOWAIT, "someprogram", "arg1", "arg2", ... , NULL); // NULL required as last argument.

Nathan Mates
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top