home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / mswindo / programm / misc / 1102 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  3.1 KB

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