Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
506 views
in Technique[技术] by (71.8m points)

visual studio - 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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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).

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...