Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 May : How to run a console application and get data from it?

www.cryer.info
Managed Newsgroup Archive

How to run a console application and get data from it?

Subject:How to run a console application and get data from it?
Posted by:"Bo Berglund" (bo.berglu..@telia.com)
Date:Mon, 21 May 2007 21:16:57

I am trying to go around the problem of communicating between 64bit
and 32bit applications. The DLL route is closed (see another thread)
so now I am exploring a different road:
I create a command line application that will accept a few command
line arguments.
These arguments are used to check for some data and then return them
in encrypted format using one of the supplied parameters as half the
key. The other half is a random number known by both applications.
The data will be encrypted numbers (5 of them) written to STDOUT by
the console application before it quits.

My question now is this:
How can I read back the data in the calling application?
Is it possible to use CreateProcess to launch the application with the
needed parameters and then wait for it to quit (WaitForSingleObject)
and then read STDIN (ReadLn)???

Or how can I do otherwise?

I need to make the console app behave like a DLL function call that I
can make at will.

/Bo

Replies:

www.cryer.info
Managed Newsgroup Archive