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.