Windows Form App using Visual C++

I am trying to develop a WFP using Visual C++ in visual studio 2015. I found an answer by onContentStop on this forum saying that the only way to do it was to insert forms into a CLR project, I tried it but it still doesnt work.

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:
<
#include "[FORM NAME].h"

using namespace System;
using namespace 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)".

After doing that I got the following errors, can anyone help me solve it?
[project name} and %form are underlined in red
-attributes are not allowed here
-expected a declaration
-expected an identifier
-identifier "form" is undefined
After creating a project with the name FormDemo and a form with name MainForm and following the above instructions the file MainForm.cpp looks like this.
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "MainForm.h"

using namespace System;
using namespace System::Windows::Forms;

[STAThread]
void main(array<String^>^ args) 
{
  Application::EnableVisualStyles();
  Application::SetCompatibleTextRenderingDefault(false);
  FormDemo::MainForm form;
  Application::Run(%form);
}


After setting the linker properties it compiles and runs fine.
Thanks man, I completely forgot to remove the brackets [ ]
But now I get the error : Element <SubSystem> has an invalid value of "Windows (/SUBSYSTEM/WINDOWS)".
Here is the complete project. Try if it works for you.

https://www.dropbox.com/sh/vnh3gc1l0ke90qg/AAAxiUpBUyoN5WXXzROXxMNia?dl=0
I still faced the same problem but I found my mistake. I am supposed to use "Windows (/SUBSYSTEM:WINDOWS)" not "Windows (/SUBSYSTEM/WINDOWS)"
Topic archived. No new replies allowed.