Hello,
I wonder if it is possible to retrieve a string from another application. For example
I have application 1 of console type APP1 which has the following code
procedure GetMessage;
var
AProcess: TProcess;
OutputLines: TStringList;
begin
AProcess := TProcess.Create(nil);
AProcess.Executable := 'APP2.exe';
AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes, poNoConsole];
AProcess.Execute;
OutputLines := TStringList.Create;
OutputLines.LoadFromStream(AProcess.Output);
write(OutputLines.Text);
AProcess.Free;
end;
I have the application of GUI type APP2 which has the following code ....
procedure TForm1.FormCreate(Sender: TObject);
var
InPipe : TInputPipeStream;
OutPipe : TOutputPipeStream;
s: String;
begin
InPipe := TInputPipeStream.Create(Handle);
OutPipe := TOutputPipeStream.Create(Handle);
s:='my text';
OutPipe.Write(s[1], Length(s));
CreatePipeStreams(InPipe, OutPipe);
Close;
Application.Terminate;
end;
The above codes are compiled and run, but I do not get the value of the second application.
How to retrieve the string generated in APP2 through APP1?
Tanks
André