• Advertisement

Archived

This topic is now archived and is closed to further replies.

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

This topic is 5039 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You could try to redirect the output of the compiler to a file, and then read that file in your program.

Share this post


Link to post
Share on other sites
Yeah, piping is your friend. Read up on batch scripting; you''ll learn techniques for redirecting streams.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement