[Lazarus] GUI Front-end to Windows console application???

Sven Barth pascaldragon at googlemail.com
Tue Jan 18 14:03:33 CET 2011


Am 18.01.2011 10:05, schrieb Andreas Schneider:
> On Mon, 17 Jan 2011 23:52:58 +0100, Bo Berglund wrote:
>> So far so good, but when I read the help on TProcess it says that this
>> property applies only to Windows. So what happens on Linux?
>> Will the console show up on screen then?
>> Or is it automatically hidden in Linux?
>
> There is nothing to hide on *nix. STDOUT is available for all processes
> and if that gets used by any tty is another matter. Want a console? Run
> the tool inside a console. Don't want one? Don't run it inside a console.

TProcess may start a console window application (e.g. XTerm though). 
This can be suppressed using poNoConsole.

> It's (afaik) only Windows (or PE for that matter) that has this (kinda)
> stupid flag to distinguish between a console app and a GUI app.
>
> Just as side node: even Microsoft has to work around this design
> decision for VisualStudio (and maybe other tools) that should behave
> differently if run from commandline or from GUI. Because in the first
> case they should only output to the cmd and not show any window and in
> the latter case they should show a window and not use stdout.

An application that is compiled as CUI application can use a GUI without 
problem (I'm sometimes simply adding {$apptype console} to ease 
debugging). The real difference only appears if you run in a console 
(e.g. cmd) or in a fullscreen console only environment (on Windows servers):
In the first case if you run a GUI compiled application in cmd the shell 
won't wait till the process terminates while it will wait for one 
compiled as CUI.
In the second case you'll either get an error message if you start a GUI 
application or the system will switch to GUI mode (this is implemented 
in ReactOS for example).

Regards,
Sven




More information about the Lazarus mailing list