User Tools

Site Tools

blog:2023-11-15_visual_c_winform_project_startup



2023-11-15 VC++/CLR: Winform Project Startup

  • To design the Visual C++ based WinForm program, the step as follows.

Tool Prepare

  • Add C++/CLR module in Visual Studio
  • Updating

Project Setting

  • New CLR empty project
  • Create Project. Here, we named it as “CPP CLR Test”
  • Project → Property → Linker → System → SubSystem
    • Set as “Windows(/SUBSYSTEM:WINDOWS)”
  • Project → Property → Linker → Advanced → Entry Point
    • Set as “main”
  • Header Files → Add UI → Windows Form
    • Named as “MainForm.h”
    • We got an error message, close it
  • We cannot edit the MainForm by FormEditor, just close the project and launch the Visual Studio again
  • Now, we can edit it by Form Editor
  • Add the main() in MainForm.cpp
    • #include "MainForm.h"
      
      using namespace System;
      using namespace System::Windows::Forms;
      
      void main(array < String^>^ args)
      {
      	Application::EnableVisualStyles();
      	Application::SetCompatibleTextRenderingDefault(false);
      	CPPCLRTest::MainForm form;
      	Application::Run(% form);
      }
  • Now, we can compile and run it

TAGS

  • 52 person(s) visited this page until now.

Permalink blog/2023-11-15_visual_c_winform_project_startup.txt · Last modified: 2023/11/23 09:21 by jethro

oeffentlich