2

I have a Delphi console application which does not have any write or read statements (i.e. no interaction with the console). Yet, when I run the program the console does flash momentarily on the screen.

I would be most grateful if someone can tell me how to prevent this flashing. I suspect that I have to adjust some or other compiler setting, but I can't find which one.

Thanks in advance!

  • Minimize it, move it out of screen, etc. What does it do? It is quite impossible to answer a question regarding a problem that we can't reproduce. – Tom Brunberg Jun 02 '17 at 10:20
  • [How do I hide the console window?](https://stackoverflow.com/q/13042036/327083) – J... Jun 02 '17 at 10:46
  • [Delphi - Hide console window](https://stackoverflow.com/q/13056642/327083) – J... Jun 02 '17 at 10:46
  • [How to show/hide a console window app?](https://stackoverflow.com/q/42767078/327083) – J... Jun 02 '17 at 10:48
  • 1
    @J... The links you have posted all have the word "Hide" in them. I think that the question is actually how to make sure that the console window is not displayed in the first place. – Torbjörn Olsson Jun 02 '17 at 11:56

2 Answers2

7

If it does not write to the console, why do you make it a console application? Make it a VCL application without a form and put the code into the dpr just like with a console program.

As Craig Young pointed out in his comment:

A simpler approach is to create a console application and delete the line

{$APPTYPE CONSOLE}
dummzeuch
  • 10,975
  • 4
  • 51
  • 158
  • While this method does inflate the application a teensy bit, it is most elegant. – Sherlock70 Jun 02 '17 at 14:01
  • it is inflated only if you enable the VCL. If you don't actually need the VCL, don't enable it. – Remy Lebeau Jun 02 '17 at 14:42
  • It's not whether it's a VCL app that matters. It's the target subsystem. Target the GUI subsystem is what is needed. – David Heffernan Jun 03 '17 at 04:45
  • Default resources may make it large - multi-resolution icon, VCL themes... There were articles like "while minimum EXE of Delphi XE7 is so much larger than one of Delphi 7" dissecting what made EXEs grow – Arioch 'The Jun 05 '17 at 08:25
  • 2
    A simpler approach is to create a console application and delete the line `{$APPTYPE CONSOLE}` – Disillusioned Jun 05 '17 at 13:15
0

Use

{$APPTYPE GUI}

Instead of

{$APPTYPE CONSOLE}
viniciusalvess
  • 756
  • 8
  • 18