Re: Writing to others Process STDIN



On Tue, 21 Jun 2005 18:08:58 +0200, Egon Rath wrote:

> On Mon, 20 Jun 2005 19:05:27 +0200, Egon Rath
> <egon-nospam@xxxxxxxxxxx> wrote:
>
>>Hi,
>>
>>i am trying to write to a other's process standard input. I've played
>>around with the OpenProcess and DuplicateHandle Functions - without
>>any success.
>>
>>below is my test code (compiles but doesn't work)
>>
>
> Hi,
>
> first of all, thank you for answering.
>
> Ok, the part with the source/target is now clear. I've read in the
> MSDN Documentation to DuplicateHandle that it only works for
> duplicating Console Input/Output Handles if the Process is a child of
> the calling process where the Duplication should occur.
>
> The situation i need to master is as follows:
>
> We are running a application which consists of about 30 open command
> line windows where in each of this windows runs a Java Process.
> Sometimes when a complex bug in this application occurs it's necessary
> to step through all of these windows, enlarge the console buffer to as
> many lines as possible, then press Ctrl-Break, mark the entire output
> (Java Stack Trace), copy each of the output to a text file ... and so
> on....
>
> I want to develop a way of automating this process. Do you have any
> ideas how i could do this with the Win32 API?

I gotta tell you, my first choice would not be to try to iterate these
windows and look into their console buffers. Some ideas:

1. Is there a Java debug mode that will send stack traces and the like to a
designated place?

2. Is there any way you can catch the exception and send it where you want
it?

3. Can you launch the processes with a redirected stderr?

--
Doug Harrison
Microsoft MVP - Visual C++
.