Pelles C forum

C language => Windows questions => Topic started by: tpekar on May 21, 2013, 09:28:57 PM

Title: CreateProcess child communicating to parent
Post by: tpekar on May 21, 2013, 09:28:57 PM
I am trying to use the _pipe() function to communicate back to the parent from the child process.  My question is how does the parent communicate the pipe handle to the child process?  If someone has a simple example showing how to communicate back and forth between the parent and the child that would be great!  Thanks in advance.
Title: Re: CreateProcess child communicating to parent
Post by: frankie on May 23, 2013, 10:07:44 AM
The simplest way is to use memory communication through file mapping as in this sample (http://msdn.microsoft.com/en-us/library/windows/desktop/aa366551(v=vs.85).aspx)
The same way is used by OutputDebugString as in my DebugReadser (http://forum.pellesc.de/index.php?topic=5351.0).
An example for pipes is here (http://msdn.microsoft.com/en-us/library/windows/desktop/aa373586(v=vs.85).aspx)
Title: Re: CreateProcess child communicating to parent
Post by: TimoVJL on May 23, 2013, 07:08:58 PM
Here is simplified named pipe example to test.
Easier to google when some API names are seen.
Those who know about named pipes, please correct errors in example.