locked
capturing output of the another process RRS feed

  • Question

  • Hi,

    I have created a dialog based application through which I am launching one console application( a third party application).

    The child process prints output in console.

    I want to read the output of this console application in  my dialog based application so that it will continuously  update my dialog box

    How to achieve this IPC ?

     

     

    Thursday, January 27, 2011 3:24 PM

Answers

  • You need to create the process, and redirect it's output to a handle your process reads from.

     

    MSDN has a great example demonstrating how you can use Pipes to create a process and redirect it's standard input and output streams to your own process.

     


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by Josh Poley Thursday, January 27, 2011 6:34 PM
    • Marked as answer by Jafar Kumarkiri Friday, January 28, 2011 10:28 AM
    Thursday, January 27, 2011 4:34 PM

All replies

  • You need to create the process, and redirect it's output to a handle your process reads from.

     

    MSDN has a great example demonstrating how you can use Pipes to create a process and redirect it's standard input and output streams to your own process.

     


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by Josh Poley Thursday, January 27, 2011 6:34 PM
    • Marked as answer by Jafar Kumarkiri Friday, January 28, 2011 10:28 AM
    Thursday, January 27, 2011 4:34 PM
  • Thanks Reed :)
    Friday, January 28, 2011 10:28 AM
  • Hi,

    I want to read output of a process having code as,

    int main()
    {
    	for(int i=0;i<20;i++)
    	{
    		cout<<"\r"<<i;
    		Sleep(500);
    	}
    	return 0;
    }

    but parent application is blocked until it completes the execution and ReadFile return when the loop is completed and it returns the complete output in it's out parameter.

    How can I achieve it asynchronously?

    Thank,s

     

    Thursday, February 3, 2011 5:38 AM