Hide console of Windows Application

Viewed 115143

I have a Qt application, and when I run this application, there is a console opening behind it. In development it is nice because i see debug outputs on the console, but when I want to give this executable to the customer there should be no console window. how do I hide it?

(I am using Visual Studio 2008)

13 Answers

It sounds like your linker configuration is incorrect. Right-click the project, Properties, Linker, System, SubSystem setting. Make sure "Windows" is selected, not "Console".

And, change main() to WinMain().

i use that method and it worked

HWND hwnd = GetConsoleWindow();
ShowWindow(hwnd, 0);

May be the better option will be not to simply remove (as Andy M suggested) but edit *.pro file adding something like

CONFIG(debug, debug|release) {
    CONFIG *= console
} 
else {
    CONFIG -= console
}

In debug you can see console window but not in release. I like it. =)

I would suggest to check the presence of the following line in your .PRO file :

CONFIG += console

If you can find it, remove it ! It should fix your issue !

Hope it helps !

step 1:- Set Properties->Linker->System->SubSystem is "Windows (/SUBSYSTEM:WINDOWS)"
Step 2:- Linker->Advanced-> Entry Point "main"

If all of the properties settings not working above, maybe check to delete 'return app.exec' and 'system("pause")' would help

Related