how to get text in a window when executing another .exe?

Started by
2 comments, last by McZ 19 years, 11 months ago
my program will create a window and execute some other .exe file and now I want to recive the input from the other program to my own window. for example if I create an editor for editing source files and then I want to support the compiling stuff in that editor I want to recive the compilers output ( gcc or some other free compiler ) so I can display it in a window in my editor
Advertisement
You could try to redirect the output of the compiler to a file, and then read that file in your program.
Yeah, piping is your friend. Read up on batch scripting; you''ll learn techniques for redirecting streams.
In win32 I think you have to create two (or more) (anonymous) pipes.

There are examples on MSDN, but basically it''s a bit of pain in the arse because pipes are created non-inheritable by default, so you have to duplicate the ends of the pipes you want to inherit in the child process.

Then call CreateProcess with the various structures set up to direct stdin/stdout/stderr into the appropriate ends of those pipes you created.

Then you just read from the output pipes and put the results into your window - somehow.

If you don''t want input (for example if compiling) you can either leave stdin as default, or open NUL and put it into there (not sure what the difference is, try the easier one first).

Mark

This topic is closed to new replies.

Advertisement