Assuming your DOS program supports I/O redirection (have you tried it from a command prompt?); to get I/O redirection when running a command line .EXE using WinExec() or CreateProcess(), you actually need to start an instance of the command processor and have it run the .EXE.
So you'd pass a command string to the API call something like: 'drive:\path\CMD.EXE /c yourdosapp.exe parameters < input.file > output.file' The /c parameter tells CMD.EXE to run the command and then exit. Note that you can get the actual name of the command processor by checking the COMSPEC= environment variable, some folks do use others besides CMD.EXE (though it should still be present). Any self respecting console mode command processor running in a Windows environment should support the syntax for redirection as shown. HTH Stephen Posey stephenlpo...@earthlink.net -----Original Message----- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of Rich Cooper Sent: Wednesday, June 10, 2009 7:20 PM To: 'Borland's Delphi Discussion List' Subject: Add *.exe program into a main program Hi All, I've found an *.exe file that runs (D7 / Vista) in DOS mode like a batch file command. When running, it gives a prompt and stops. 1. I could execute it as a batch job and pipe the input and output, if I can figure out how to do that in old DOS command language. 2. But that would mean loading the *.exe for each call, executing it, managing the interface pipes and process contexts; Isn't there a way I can put it into my D7 source program as a resource of some kind, or load it once and link it up that way somehow? If it would only load once, when the program starts. Each time the *.exe runs, it could make a copy of itself to run and destroy the answer when completed. Suggestions appreciated, -Rich Sincerely, Rich Cooper EnglishLogicKernel.com Rich AT EnglishLogicKernel DOT com _______________________________________________ Delphi mailing list -> Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi ****************************************************************** This email and any files transmitted with it from the El Paso Corporation are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. ****************************************************************** _______________________________________________ Delphi mailing list -> Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi