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
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus