Recent

Author Topic: Is it possible to stop the console window appearing in a console application.  (Read 963 times)

josh

  • Hero Member
  • *****
  • Posts: 726
Hi

I have created a little app that accepts extra parameters which are then passed on to the main application.

This is working well, the only slight annoyance is that each tiome the utility is run, a quick terminal window appears and dissapears.

is it possible to stop the utility from invoking/hiding the console window

Hope that makes sense.
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5245
    • wiki
If you run the up from an already open console (cmd.exe) then no extra window should happen)

But you can compile your app as {$apptype GUI} (or similar), or use -WG

Then windows thinks it is a gui app, but since it does not open a form, nothing will appear.
However, in this case, if you want to use writeln to stdout or read stdin, you must first check they are open.

josh

  • Hero Member
  • *****
  • Posts: 726
Hi Martin,

Thanks for your reply.

You beat me to answering my own question.

I turn on the -wg option in Project Options, just to see what would happen, and bingo.

Josh
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.