Reputation: 164
I created a empty CLR project in Visual Studio 2017 and added Windows Forms. After starting the app there opens a command prompt and my form application. Is there any way to diable the command prompt? Sreenshot
Upvotes: 3
Views: 1857
Reputation: 164
Ok. Finaly I got the forms working correctly with just seting the entry point to main and the SubSystem to Windows (/SUBSYSTEM:WINDOWS). Also I added some lines to the MyForm.cpp. Now it looks like
#include "MyForm.h"
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Project1::MyForm mainForm;
Application::Run(%mainForm);
return 0;
}
Thanks to: @ AntonMalyshev and @zx485
Upvotes: 1
Reputation: 8861
You need to change running subsystem from Console to GUI in project's properties (see the image attached).
Also don't forget to use int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow);
as your main function.
Upvotes: 3