home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!bonnie.concordia.ca!hobbit.ireq.hydro.qc.ca!beaurega
- From: beaurega@ireq.hydro.qc.ca (Denis Beauregard)
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: Re: Capturing DOS output?
- Message-ID: <Bs7txq.G7y@ireq.hydro.qc.ca>
- Date: 30 Jul 92 18:56:14 GMT
- References: <rcgmm3l.jfh@netcom.com> <1992Jul24.052054.24347@monu6.cc.monash.edu.au>
- Sender: news@ireq.hydro.qc.ca (Netnews Admin)
- Organization: Institut de recherche d'Hydro-Quebec, Varennes, Canada
- Lines: 50
-
- In article <1992Jul24.052054.24347@monu6.cc.monash.edu.au> steve@monu6.cc.monash.edu.au (Steve Balogh (+61 3 565 4747)) writes:
- >In article <rcgmm3l.jfh@netcom.com> jfh@netcom.com (Jack Hamilton) writes:
- >>I'd like to run a DOS application from inside a Windows application, and
- >>have the output from the DOS program appear in a window controlled by my
- >>Windows program.
- >>
- >>I looked at WinExec, but there's nothing obvious in the documentation. Is
- >>there some other way to do it?
- >>
- >>By the way, I'd like the window to scroll as the DOS program creates more
- >>output (which will be to stdout), so redirecting the output to a file and
- >>then displaying the file won't do what I want.
- >>
- >>While I'm asking for the impossible, can I capture stderr separately?
- >>
- >
- >I am doing a similar thing in a program I am writing. The method I use is to
- >redirect the stdout of the dos program to a temporary file (preferably on a
- >RAM disk) and then open the file on a 1 second WM_TIMER message. Read the file
- >until it hits EOF, save the current location within the file, and then close it.
- >The next time I open the file, I then seek to the saved location and then read
- >till EOF again. I keep repeating this procedure until the displying window is
- >closed by the user. The method appears to act like the Unix "tail -f" command.
- >
- >I don't think this is the best way to achieve this task, but it is the best that
- >I have come up with so far. Any better methods would be appreciated. Let me
- >know if you find one. :-)
- >
- >Steve
- >
- >----_--_-_-_--_-__-_------_-__---_-___-_----_-____-_-_--__-_--_--___-_-_-_--__-_
- >Steve Balogh VK3YMY (Maths G.14) | steve@monu6.cc.monash.edu.au
- >Monash University, Clayton Campus | 37 54'38.8"S 145 07'47.1"E ...ICBM
- >Wellington Road, Clayton. | +61 3 565 4747 Voice (Office)
- >Melbourne, AUSTRALIA. 3168 | +61 3 565 4746 Fax
-
- One quite complex solution (he! one could write this for every others!)
- would consist in writing a device driver with 2 device names like
- DIN and DOUT (device IN and OUT). You culd then open and write to DIN
- and the other program could open and read from DOUT. Very simple
- to say, not so hard to program, but, would it work under Windows?
- ANSI.SYS device driver redirect CON, so Windows detects it and cancel
- the effect of ANSI driver. Any other driver with non-standard name
- should work too, no?
-
- --
- \_\ Denis Beauregard * internet:beaurega@ireq.hydro.qc.ca
- / \ Genealogiste officiel : Beauregard/Jarret/Jarest/Vincent
- J __> Barthelemy Jarret (1471) -> Andre Jarret, sieur de Beauregard (1665)
- \_.-=== -> Denis Beauregard (1992) Opinions ? Et pis non !
-