Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find Windows Forms Application for C++

I'm really new to visual studio and programming in general. I'm using Visual Studio Community 2015 Desktop Version (from what I know). I can't find a Windows Forms Application from the C++ category, while there is one for C#.

Can anyone help, do I need to download another version, a plugin, or anything? Sorry if a stupid question, I just really can't figure it out!

like image 276
Marked as Duplicate Avatar asked Sep 04 '15 18:09

Marked as Duplicate


People also ask

How do I install WinForms?

In the WinForms Edition tile, click on the Install button. You can also install all editions by selecting the checkbox against All Editions. Click the View More button to know more about the Edition. Upon clicking the Install button, a page is displayed asking to review the License Agreement.

Where is Windows Forms DLL?

Windows. Forms. dll is located in the folder C:\WINDOWS\Microsoft.NET\Framework\v2.


2 Answers

There are no C++ Windows Form templates in Visual Studio 2015. As I see it, you have two choices:

  • When creating a new project, You will see an online dropdown, click that and try to search for "C++ Windows Forms".
  • Create an empty C++ CLR project and add a Windows Forms to it. This link puts it like this (credit to the onContentStop, the user who posted this):

    1. Make a "CLR Empty Project".
    2. Press Ctrl-Shift-A and create a Windows Form (under UI).
    3. 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);     Application::Run(gcnew [PROJECT NAME]::[FORM NAME]); } 
    4. Right click your project in the Solution Explorer and click Properties.

    5. Under Configuration Properties > Linker > Advanced, change Entry Point to "main" (without quotation marks).
    6. Under Configuration Properties > Linker > System, change SubSystem to "Windows (/SUBSYSTEM:WINDOWS)" (without quotation marks).
like image 117
James Parsons Avatar answered Oct 09 '22 04:10

James Parsons


Though this has already been answered, I feel like this might help those who stumble across this in the future. While creating a new project, directly above the text field for naming your project, there is a blue link that reads "Click here to go online and find templates" If you click that link it will direct you to templates that are available for you to download & use. Simply use the hierarchy on the left hand side and navigate to Visual C++ and you should be able to simply click "C++ Windows Forms" and it will create the new project, while also downloading and installing the template for future use. So, next time you go to create a C++ Winform you wont have to search for it again.

like image 29
null Avatar answered Oct 09 '22 04:10

null