Re: bug in GenerateConsoleCtrlEvent?

From: Sam Jost (samjost_at_web.de)
Date: 08/03/04


Date: Tue, 3 Aug 2004 08:20:11 +0200


"Gary Chanson" <gchanson@No.Spam.TheWorld.net> wrote:
>
> "Sam Jost" <samjost@web.de> wrote:
> >
> > would I use windows messages for example it would be a hassle to profile
> > the
> > app, I would have to program an extra stub program just to start the app
> > from the profiler.
> > Automated testing: since these are FireAndForget-apps I can easily write
> > tests, feeding them with input and checking the output automatically.
Dead
> > easy with console apps. Extra work with other ways of communication.
> >
> > Or do I miss some good way to communicate?
>
> It's hard to find a signalling method easier then an event (not a
> console event). One program creates and event and the other opens it (see
> CreateEvent and OpenEvent). One program sets the event to signaled and
the
> other can either wait on the handle or simply checks at its convenince to
> see if it's signalled.

The only thing is you need to get the name or id of the event to the
subprocess somehow.
Reminds me of vcspawn.exe.

> > For this I would have to do some digging to find the windows handle of
the
> > console window and hide it, or how would one achieve this? Or can I hide
> the
> > console window in the process.Start call somehow (hide, not minimize, as
I
> > said it should not be seen)?
>
> If you start a program using CreateProcess, you can specify the show
> state of the program. If you specify SW_HIDE, you get a hidden window.

I would need to PInvoke that call then. I'll need to try how that will
look&feel.

Pity the .net framework does not really support one of the oldest most basic
communication need to call console programs, communicate with them *and* end
them.

I'll have to check these out a bit more to see how well they work in what
environments.

thanks for the diskussion,
Sam



Relevant Pages