[Lazarus] Reading from an external process
Sven Barth
pascaldragon at googlemail.com
Tue Nov 5 16:32:55 CET 2013
Am 05.11.2013 14:48, schrieb Richard Mace:
> Hi All,
> I have got the following code from the wiki for creating and reading
> from an external process. Effectively, I want to capture all of the
> output from the process "handle.exe", into a StringList so that I can
> read it to make sure that everything went OK, however, when I run the
> following code, I am getting a "RunError(103) on the line: WriteLn('--
> Going to run: ' + OurCommand);
>
> Any ideas what I'm doing wrong please?
Is your application (that one which calls handle.exe) compiled as a GUI
application or not? (check in the project settings) If it is compiled as
a GUI application then disable the option and recompile. An additional
console window should now appear when you run the application from
within Lazarus in which you'll see your output.
Reason: on Windows the I/O is closed on startup if the application is
compiled as a GUI program (Delphi compatible)
Alternatively you could use a Memo. Either you directly use
YourMemo.Add('...') or if you want to keep using Writeln, I have a unit
sent somewhere on the mailing list some days ago that allows you to
assign a memo or edit to a TextFile so that you could use either
Writeln(YourFile, '...') or you could override "Output" so that you
could keep using Writeln('...').
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131105/a8aedf7c/attachment-0003.html>
More information about the Lazarus
mailing list