Sunday, November 18, 2012

How to create a Windows Forms Application Project in Visual C++ Express 2012

Add this code to your main source file. In my tutorial that is MyForm.cpp

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

[STAThread]
void Main(array<String^>^ args)
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);

    FormsTutorial::MyForm form;
    Application::Run(%form);
}

9 comments:

  1. u sir! just made my life a lot easier.

    ReplyDelete
  2. This should be obvious but for newbies, don't forget to add
    #include "MyForm.h"
    in MyForm.cpp

    ReplyDelete
  3. "FormsTutorial::MyForm form;
    Application::Run(%form);"

    Excuse me, it doesn't run. Everybody can help me?

    ReplyDelete
  4. I chnged the "FormsTutorial" part to my project name , yet form doesn't run ! :/

    ReplyDelete
  5. Funcionó de lujo en Vultimate2013 ;) gracias! mucho trabajo abreviado en esto :D

    ReplyDelete