1

I have a basic console window. It is blank and all my program does is run though sockets to a host computer. How do I make the black console window not visible?

I'm using Delphi 2007.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
user1770015
  • 185
  • 2
  • 3
  • 9

1 Answers1

9

Remove

{$APPTYPE CONSOLE}

from the source code...

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
A Lombardo
  • 774
  • 5
  • 25
  • 3
    This makes your application target the GUI subsystem rather than the console subsystem. And that's exactly what you want to do here. – David Heffernan Oct 24 '12 at 06:26
  • I removed {$APPTYPE CONSOLE} but then it would not connect the socket... – user1770015 Oct 24 '12 at 12:11
  • 1
    Then your problem is elsewhere, User. The console or GUI subsystem has nothing to do with whether you can connect to sockets. Keep investigating. – Rob Kennedy Oct 24 '12 at 20:58
  • 4
    I removed '{$APPTYPE CONSOLE}' in Delphi XE7, and it didn't work. Then I replaced it with '{$APPTYPE GUI}', and it worked. The console then stopped working completely of course. I needed the console for reporting possible errors, and reenabled it on demand with 'if GetConsoleWindow = 0 then AllocConsole;' – Bent Tranberg Dec 09 '14 at 20:09
  • @BentTranberg Thanks for the hint. Just wondered about this on XE7 myself. – Günther the Beautiful Feb 26 '15 at 09:14
  • That won't work on Delphi XE7 – Gabriel Mar 13 '17 at 15:03