I am currently working on a project for school that needs to start a Windows Forms Application under the Visual C++ category. Unfortunately, this template (Windows Forms Application) has not existed in C++ for 3 years. Microsoft took it out in the 2012 release of Visual Studio. Is there a workaround for this?
Can I just use the WIN32 Console Application instead? Thank you!
There is a workaround, with several steps:
1. Make a "CLR Empty Project".
2. Press Ctrl-Shift-A and create a Windows Form (under UI).
4. Inside the CPP file that is created, paste this code, replacing anything in square brackets except "[STAThread]" with the appropriate names:
1 2 3 4 5 6 7 8 9 10 11 12
#include "[FORM NAME].h"
usingnamespace System;
usingnamespace System::Windows::Forms;
[STAThread]//leave this as is
void main(array<String^>^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
[PROJECT NAME]::[FORM NAME] form;
Application::Run(%form);
}
5. Right click your project in the Solution Explorer and click Properties.
6. Under Configuration Properties > Linker > Advanced, change Entry Point to "main" (without quotation marks).
7. Under Configuration Properties > Linker > System, change SubSystem to "Windows (/SUBSYSTEM/WINDOWS)".
This should work for you, but tell me if it doesn't.