Reputation: 101
I'm currently making a C++ GUI application, but I have the following problem. In the program I have one MyForm.cpp and one Myform.h (just one button). When the application starts the console and the form opens. Is this default? Or how can I disable it? The code in the main is:
#include "MyForm.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThread]
int main(array<String^>^ args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Namespace::MyForm form;
Application::Run(%form);
}
Hope that someone can help?
Upvotes: 2
Views: 2568
Reputation: 455
Add this in your .pro file :
ENTRY = mainCRTStartup
OR
in VS, right click on your project -> properties -> linker -> system
And select "Windows (/SUBSYSTEM:WINDOWS)" for SubSystem.
Upvotes: 3
Reputation:
If you are using a CRT build and there is no WinMain function you can use this:
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")//hide console window
to hide the console.
Upvotes: 2