Reprinted from: http://www.th7.cn/system/win/201509/129417.shtml
VS2010 and previous versions, when you create a project, you can find the project template for Windows Forms applications under the CLR, but VS2012 later versions are less convenient. You can modify the old version of the project by opening it, or you can do the following:
here, take VS2015 as an example, open VS2015 as shown:
As we all know, WinForm needs. NET support. So we need to create a CLR empty project with the following steps:
① New Project
② Select CLR Empty Project
③ Results
Add WinForm Header file:
① Right-click on the header file to add New item
② Select UI for Windows Forms
③ Results
Note that the results here in the third step may be ( please note!) It was possible, anyway on my computer. error: to avoid possible data loss before loading the designer, you must correct the following error .
Here you can ignore, follow the steps to continue walking ...
There is a well-known form designer here, but it is still not allowed because there is no main function. You need to continue with the following actions:
① writing the main function code
The code here gives you attention to modifying the corresponding namespace name and the form class name.
When you get here, save the changes, turn off the error window, and then reopen it, and you'll see that it's the following:
Everything's OK! Celebrate
② click on "Local Windows debugging", results:
Then:
We found that the program could be compiled and run successfully, but there was still a dark console left. Next, we'll remove the console by setting it up:
① Right click on Project, set project properties
② subsystem changed to window
The ③ entry function is set to main
④ again, the black box is gone.
C++/CLR using (vs2012,vs2013,vs2015) writing