Board index » delphi » Problem executing programs in Delphi

Problem executing programs in Delphi

Does anyone know a method of redirectinng the output of a program that a Delphi
program runs, into a text component. I tried redirecting the output by having
my delphi program execute the command "program.exe > outputfile.txt"  but the
"program.exe" happens to expect an indefinite number of arguments, so the
redirection had no effect. I was planning on displaying the "outputfile.txt" in
a text component.

Thanks in advance
Gabe

 

Re:Problem executing programs in Delphi


Quote
WGabor wrote:
> my delphi program execute the command "program.exe > outputfile.txt"  but the
> "program.exe" happens to expect an indefinite number of arguments, so the
> redirection had no effect. I was planning on displaying the "outputfile.txt" in
> a text component.

If you create a pipe (using CreatePipe()?) and supply this handle to one
of the structs that you feed CreateProcess, then you won't have to use
the temporary file at all...

--
Rune

Re:Problem executing programs in Delphi


Quote
Rune Moberg wrote:
> If you create a pipe (using CreatePipe()?) and supply this handle to one
> of the structs that you feed CreateProcess, then you won't have to use
> the temporary file at all...

Forget that.

Go to http://www.dejanews.com and choose "Power search".

In the newsgroup field, enter: comp.lang.pascal.delphi.*
and in the freetext field just enter: createpipe createprocess

You'll find a couple of entries, including one I wrote a year ago which
comes with some example source on how to do this.

--
Rune

Other Threads