Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing MS-DOS Program output in VS Output Pane 1

Status
Not open for further replies.

gjraynor

Programmer
Oct 31, 2001
12
AU
Does anyone know of a way to "TEE" the output of an MS-DOS Program into the VS6 Output Pane? I have tried running it from a batch file and treating the bat file as a tool and directing its output etc. but there seems to be problems with all the TEE tools available.
 
You could do this:
1) Start the DOS program within you application and capture it's output (requires advanced overlapped I/O and pipes knowledge)
2) For each captured line you can call OutputDebugString API. During the runtime of your app, VS is registered as the debugger and will display your string (check the OutputdebugString description in MSDN).
3) The advantage of this approach lets you use any other software that can capture and display debug messages (such as the free DebugView available here: )

P.S.: When capturing DOS program output and writing to debug output pay special attention to synchronization issues.
 
Thanks. I have used DebugView on 32 bit programs. My problem here is that the DOS 16 bit program IS the App. I am just using VS6 as a convenient dev environment.

I was hoping there was some trick - or utility - that would enable the DOS output (which is itself just DEBUG info as the app writes its release info directly to the video buffer) - to be automatically copied or redirected into the VS Output pane. This would save a lot of time over just having the output in a text file within the project.
 
If you're interested in an example check this:
Unfortunately there is no trick or utility to do what you need. That is simply because the DOS program runs under a simulated environment (a virtual machine, actually) called NTVDM (which stands for "NT Virtual DOS Machine") or WOW (which stands for "Windows on Windows"). They are both names for the same Win16 subsystem that runs under Windows NT, 2000, and XP.
 
Thanks again. I understand the problem with NTVDM operating in a VM making communication with the 32 bit VS difficult.
I guess the easiest "copout" is to forget the real time aspect of it and write a little utility that just opens the redirected file and outputs it with ::OutputDebugString().
It just detracts from the utility of using VS for 16bit program development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top