你可以使用
Output
来自的属性
TProcess
对象。
尝试此代码
var
AProcess: TProcess;
begin
if SaveDialog1.Execute then begin
AProcess := TProcess.Create(nil);
try
AProcess.CommandLine := 'gcc.exe ' + SaveDialog1.FileName + ' -o '
+ TextField23.Text;
AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
AProcess.Execute;
OutputForm.OutputMemo.Lines.BeginUpdate;
//OutputForm.OutputMemo.Lines.Clear;
OutputForm.OutputMemo.Lines.LoadFromStream(AProcess.Output);
OutputForm.OutputMemo.Lines.EndUpdate;
finally
AProcess.Free;
end;
end;
end;