On Sat, 22 Feb 2014, MegaBrutal wrote:

2014-02-21 10:18 GMT+01:00 Michael Van Canneyt <mich...@freepascal.org>:
      You can check the handle of the StdOutputHandle variable. if it is 
invalid (-1), you don't have output.



Thanks for your reply, it helped a lot! StdOutputHandle is 24 when I start the 
program on the console, and 0 when it starts as a
service. Which means, StdOutputHandle doesn't get initialized in service mode! 
I don't know why is this - the older runtimes didn't
have this problem. It's present since 2.6.2.

It does not necessarily mean this. It can also mean that windows returns 0 as StdOutputHandle if the service manager has started the program,
depending on how the program was compiled (GUI or console app).

2.6.0 has been released in 2012. The code that sets up stdin/out/etc hasn't changed at least since 2008-09-10 (and probably way before that).
and it is executed unconditionally.

Once more: The RTL itself does no checks to see whether a program is a service or not, only whether the APPTYPE is console or GUI.

So maybe the IsConsole behaviour has changed.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to