Discussion Locked

Capture Output from DOS BOX using WinAPI

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi I am using Borland Delphi 2.
I am seriously stuck on how to capture the output of a DOS BOX into either a file or a Memo Box control. I have tried reading up on the win API on how to implement it but I am stuck!!!! I am currently using the CreateProcess function as provided by the win API. I could seriously use some help!!!!!!!!!!!

Rakhesh Rao

5 replies

by michel

in the _STARTUPINFO structure, you should assign handles to each of the std I/O devices for the new process. Ideally, you would set hStdOutput and hStdError pointing to a pipe from which you read the output, and hStdInput to a pipe on which you supply input... If this Delphi thingy does not allow you to manipulate pipes, create files for each of these things, and pass the file handles to the process. If you can't find handles in Delphi, you have a problem...
Carefull: if you assign one handle,you must assign all!

by hclarius

If it is just text data, you should be able to route the output to a file using pipe (>).
Example: "DIR > myfile.txt" - routes the directory list to myfile.txt. You can then use loadfromfile method of memo (if version 2 supports that). You could also visit borland API newsgroup.
MORE IMPORTANT, YOU NEED TO UPGRADE. YOU ARE ONLY LOOKING FOR PROBLEMS USING VERSION 2.

by rakheshrao

This was the first thing i tried but somehow the program that i want to capture doesnt create the temp file to store the information. On the other part the only reason I am using Delphi 2 is that I got it free and cant afford a newer version!

This discussion is closed to new replies.