Maybe I could help you and write a procedure to do the calling of the external app?
BTW: beta27 made no processQ for me :bounce:
EDIT: I made a function:
function GetDynPage(AppName, UserParams, URLParams:string; var Output:TStream):boolean;
var
SUInfo: TStartupInfo;
ProcInfo: TProcessInformation;
CmdLine,TempFile: string;
Path:array[0..Max_Path] of char;
s: array[0..Max_Path] of char;
begin
// Generate Temp File
GetTempPath(Max_Path,Path);
GetTempFileName(Path, 'hfs', 0, s);
TempFile:= s;
DeleteFile(TempFile);
{ Enclose filename in quotes to take care of
long filenames with spaces. }
CmdLine := format('"%S" "%S" "%S" "%S"',[AppName,UserParams ,URLParams,TempFile]);
FillChar(SUInfo, SizeOf(SUInfo), #0);
with SUInfo do begin
cb := SizeOf(SUInfo);
end;
Result := CreateProcess(NIL, PChar(CmdLine), NIL, NIL, FALSE,
CREATE_NEW_CONSOLE or
NORMAL_PRIORITY_CLASS, NIL,
PChar(ExtractFilePath(AppName)),
SUInfo, ProcInfo);
{ Wait for it to finish. }
if Result then
WaitForSingleObject(ProcInfo.hProcess, INFINITE);
// Load Temp File if Present
if FileExists(TempFile) then
Output:= TFileStream.Create(TempFile,fmOpenRead)
else
Output:= nil;
end;
// Sample Call:
// The caller has to ensure that the output stream is not assigned
procedure TForm1.Button1Click(Sender: TObject);
var str:TStream;
app,user,url,p:string;
begin
app:= 'C:\Serv\tools\doit.exe';
user:= 'test';
url:= 'http://localhost/test/dynamic.x?a=12&b=5';
p:= copy(url,pos('?',url)+1,maxint);
if GetDynPage(app,user,p,str) then
ShowMessage('Done. We could send stream str here');
end;
I noticed you already have a possibility to send a stream with the bodyStream property of the reply object. Maybe this could be used?