views:

112

answers:

1

Hey, I'm creating a little GLUT application and need help with hiding/removing the console window.

I am developing on windows and I already know of the various methods to hide the console window on a windows system, however is there no portable method of hiding it?

Thanks...

+1  A: 

You don't really want to "hide" the console window. What you want is to configure your compiler to generate a "Windows application" instead of a "Console application". That will tell windows to never create a console for your application. You'll need to consult your compiler's documentation to figure out how to do that. For Visual Studio, it is a step on one of the wizards.

There isn't really a good way to control the console inside of a console application. The console is designed so that the application knows nothing about it. While it is possible, as you said, it's not very portable or clean.

The correct approach if you need fine-grained control over the "console" is to implement your own window which provides a text output area where you can print things. Then you can do pretty much anything with your "console" because it isn't really a console, it's just another window owned and operated by your application.

SoapBox
+1, the correct approach is to change the executable type. Note however, that you can *easily* detach from a console by calling `FreeConsole`: http://msdn.microsoft.com/en-us/library/ms683150%28VS.85%29.aspx.
avakar