Archived

This topic is now archived and is closed to further replies.

emileej

Getting output from executed shell program

Recommended Posts

emileej    130
[platform] Language=C++ System=Windows [/platform] I would like to gain access to the output of a shell program I currently run using ShellExecute. How is that done?

Share this post


Link to post
Share on other sites
emileej    130
Thanks, but before I go into it: In the example it seems that the child process'' programming is directed towards its existence as a child process. The program I am targeting is a standalone which I have not programmed and to the source of which I have do not have access.

Share this post


Link to post
Share on other sites
SiCrane    11839
The technique works with normal C/C++ file console I/O techniques in the child process.

[edited by - SiCrane on May 26, 2004 8:27:42 PM]

Share this post


Link to post
Share on other sites
emileej    130
Ok I got it working like a charm now, but I have lost some functionality from ShellExecute that I really liked. When I create the process using this method I do not have the option of hiding the window associated with it. How is that done in this case?

Share this post


Link to post
Share on other sites
SiCrane    11839
Check out the member variables of the STARTUPINFO structure you pass to CreateProcess(). One of them should be wShowWindow, which you can use to pass any show window flags that you could use with ShellExecute().

Share this post


Link to post
Share on other sites
emileej    130
Hmm... Thats wierd. I tried to use it like this:
siStartInfo.wShowWindow = SW_HIDE;

But is does not seem to be working.

Share this post


Link to post
Share on other sites
SiCrane    11839
Did you set the STARTF_USESHOWWINDOW flag with dwFlags member variable of the STARTUPINFO structure?

Share this post


Link to post
Share on other sites