The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: jj2007 on October 11, 2008, 10:02:13 AM

Title: Redirect console output to an edit control
Post by: jj2007 on October 11, 2008, 10:02:13 AM
I have studied this thread (http://www.masm32.com/board/index.php?topic=1094.msg16357#msg16357) on Console Input-Output (as 3264 users and bots have done :bg) but could not find an answer to a fairly simple question: Can I redirect the complete output of a batch file to an edit control of my choice? In RichMasm (http://www.masm32.com/board/index.php?topic=9044.msg73814#msg73814), I use a fat batch file for the build process, and I would like to be able to better control the output, i.e. catch error messages etc.; currently it works but I don't find my solution very elegant.
Again, is there any way to tell a batch file "send everything to hEdit"?
Title: Re: Redirect console output to an edit control
Post by: Vortex on October 11, 2008, 10:32:17 AM
I guess the method is to create a pipe (http://win32assembly.online.fr/tut21.html)
Title: Re: Redirect console output to an edit control
Post by: jj2007 on October 11, 2008, 02:44:02 PM
Quote from: Vortex on October 11, 2008, 10:32:17 AM
I guess the method is to create a pipe (http://win32assembly.online.fr/tut21.html)
Yep, that's exactly the right stuff, thanks a lot, Vortex :U
(some 30 years ago I used pipes in Unix, and it was somewhat simpler - but that's a different story)
Title: Re: Redirect console output to an edit control
Post by: jj2007 on October 13, 2008, 01:08:56 PM
Quote from: Vortex on October 11, 2008, 10:32:17 AM
I guess the method is to create a pipe (http://win32assembly.online.fr/tut21.html)

My pipe is working fine now, but I encountered another problem. In the batch file whose output I redirect, there are pause instructions (e.g. when assembly goes wrong). At present, the piped batch process just jumps over the pause as if it had received a keystroke. Is there a way to handle responses to pause properly?

  mov startupinfo.hStdOutput, hWrite
  mov startupinfo.hStdError, hWrite
  ; mrm startupinfo.hStdInput, hRead ; this does not work