Hi *,
I tried invoking multiple command prompts running several batch files simultaneously (I want to have several command prompts simultaneously) using C/C++ program.
But I am not geting how to do it.
Please help me out.
Thanks in advance.
Regards
Adarsh
Create some sort of thread manager with storage for the output of the programs. Plan to dequeue and clean up this in a separate thread regularly enough so that it doesn't get too big.
For each third party app you want to 'host' create a thread. In each thread create a process. Create named pipes for each of the threads to capture the STDIN and STDOUT for each of the processes (in your case you may only need the STDOut). CreateProcess allows you to specify the specify the STARTUPINFO. This startupInfo allows you to set hStdError, hStdOutput, and hStdInput, which you can point to the named pipes, which should be pointers on a structure in your object that manages all the threads. In the threads, you (in a threadsafe way) update this data.
Then in your UI you can read or display this data independent / asynchronous to the functioning of the actual third party programs, whenver you display it you can clear the data off the 'data collector' and move it to the UI manager since as far as the command line program is concerned it's gone anyway.
Dave.