Forum > Beginners

How to hide console correctly?

(1/2) > >>

Eugene Loza:
Hi, all!
I've got a question about hiding console window in Windows.
I run Lazarus 1.4.4&1.6RC2 32 bit on Win7x64 and Debian Jessie 64&32 bit. I write a game Mazer in Castle Game Engine using Lazarus. And I have the following behavior: Together with main game window the console shows up in Win7 (as it seems to show up in any other Windows OS), but is hidden in Linux - I have to manually show Terminal output in Lazarus to see debug messages I send to the console.
The question is: how do I make the same thing on Windows systems? I need to see the Terminal only at development stage, but not in release without too many changes in the code.
There is a way to disable the console: by {$APPTYPE GUI} or the same option in Project>ProjectOptions>CompilerOptions>ConfigAndTarget>Win32GuiApplication checkbox. But it disables the console functionality completely - i.e. I get exception when trying to writeln debug messages to the console.
Or is the problem OS-specific and it is impossible to solve it in a simple&cross-platform way (only through something like {$IFDEF WIN32}{$IFDEF RELEASEMODE}(some OS-specific commands to 'hide' the console window){$ENDIF}{$ENDIF})?

taazz:
Well enable win32 gui in the project options

Eugene Loza:

--- Quote from: taazz on January 26, 2016, 09:43:44 am ---Well enable win32 gui in the project options
--- End quote ---
It disables the console completely. I need it :) I just don't need it to show up if exe is launched by a user.
Maybe later I'll switch to log files... but I have much more fun stuff to do right now than to rewrite all the debugging sequence of the program.

taazz:

--- Quote from: Eugene Loza on January 26, 2016, 09:48:59 am ---
--- Quote from: taazz on January 26, 2016, 09:43:44 am ---Well enable win32 gui in the project options
--- End quote ---
It disables the console completely. I need it :) I just don't need it to show up if exe is launched by a user.

--- End quote ---
True! so? Enable it only when compiling a release version.

Eugene Loza:

--- Quote from: taazz on January 26, 2016, 09:50:13 am ---True! so? Enable it only when compiling a release version.
--- End quote ---
Well Then I get exception on writeln(...); I need to rewrite up to 50 debug messages from different modules of the program to console... maybe I'll rewrite that part later, but not now.
UPD: I just want the console behavior in Windows the same as in Linux.

Navigation

[0] Message Index

[#] Next page

Go to full version