当前位置:网站首页>[visual studio 2019] create MFC desktop program (install MFC development components | create MFC application | edit MFC application window | add click event for button | Modify button text | open appl
[visual studio 2019] create MFC desktop program (install MFC development components | create MFC application | edit MFC application window | add click event for button | Modify button text | open appl
2022-07-02 11:46:00 【Programmer community】
List of articles
- One 、 install MFC Development component
- Two 、 establish MFC application
- 3、 ... and 、MFC Application window editing
- Four 、 Add click event for button
- 5、 ... and 、 Modify button text
- 6、 ... and 、 Open other applications of the system
- 7、 ... and 、 Blog source code
One 、 install MFC Development component
open Visual Studio Installer , And then choose modify Visual Studio 2019 , The following dialog box will pop up , choice " Use C++ Desktop development " , Then open the... On the right " Use C++ Desktop development " tab , Check " "
Select and click on the bottom right " modify " Button ,
Wait for the download and installation to complete ;
Two 、 establish MFC application
stay Visual Studio 2019 In the environment interface , choice " Create a new project (N) " ,
choice " Windows Desktop applications " Under the " MFC application " ,
Enter the relevant configuration , Project name , Storage path , Click on " establish " Button ;
Application type selection " Based on dialog " , The dialog based options are set to nothing ;
Other configurations can be selected by default , You can also choose other configurations , Click here " complete " Button ;
Automatic system generation MFC The procedure is as follows :
Click on " Local Windows The debugger " Button , Run the program :
3、 ... and 、MFC Application window editing
double-click " Resource file " Medium " MFCHelloWorld.rc " file , Get into " Resource view " ,
Click on " Resource view " Medium " Dialog " Under the " IDD_MFC_HELLO_WORLD_DIALOG " , You can view the dialog box ;
Drag a from the toolbox Button Button into the interface ,
Effect after operation :
Four 、 Add click event for button
Select and double-click the button , You can enter the corresponding code interface , Click event of Edit button ;
In the void CMFCHelloWorldDlg::OnBnClickedButton1()
Method to edit the click event of the button ;
Add the following code to this method , Click to pop up a dialog box , The content in the dialog box is Unicode String in encoded format “Hello World” ;
void CMFCHelloWorldDlg::OnBnClickedButton1(){
// TODO: Add control notification handler code here MessageBox(L"Hello World");}
The operation effect is as follows :
5、 ... and 、 Modify button text
Check button , stay " Property panel " Medium " appearance " Under the " Caption " Option is the text setting of the button ;
6、 ... and 、 Open other applications of the system
Then drag two buttons into the window , Click to open notepad and calculator respectively , UI Set as follows :
Click on the event code as follows :
void CMFCHelloWorldDlg::OnBnClickedButton2(){
// Open Notepad system("notepad");}void CMFCHelloWorldDlg::OnBnClickedButton3(){
// Turn on the calculator system("calc");}
Open Notepad :
Turn on the calculator :
7、 ... and 、 Blog source code
Blog source code : https://download.csdn.net/download/han1202012/15867695
边栏推荐
- Fabric.js 3个api设置画布宽高
- Pyqt5+opencv project practice: microcirculator pictures, video recording and manual comparison software (with source code)
- Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
- 八大排序汇总
- ren域名有价值吗?值不值得投资?ren域名的应用范围有哪些?
- flutter 问题总结
- Order by injection
- Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?
- VS2019代码中包含中文内容导致的编译错误和打印输出乱码问题
- C file and folder operation
猜你喜欢
抖音海外版TikTok:正与拜登政府敲定最终数据安全协议
Compilation errors and printout garbled problems caused by Chinese content in vs2019 code
GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
Verilog and VHDL signed and unsigned number correlation operations
How to Create a Nice Box and Whisker Plot in R
Summary of data export methods in powerbi
Pyqt5+opencv project practice: microcirculator pictures, video recording and manual comparison software (with source code)
From the perspective of attack surface, see the practice of zero trust scheme of Xinchuang
II Stm32f407 chip GPIO programming, register operation, library function operation and bit segment operation
How to Visualize Missing Data in R using a Heatmap
随机推荐
八大排序汇总
Tiktok overseas tiktok: finalizing the final data security agreement with Biden government
MySQL linked list data storage query sorting problem
Summary of flutter problems
Order by injection
预言机链上链下调研
Is it safe to open a stock account through the QR code of the securities manager? Or is it safe to open an account in a securities company?
Is the stock account given by qiniu business school safe? Can I open an account?
MTK full dump grab
easyExcel和lombok注解以及swagger常用注解
What are the methods of adding elements to arrays in JS
excel表格中选中单元格出现十字带阴影的选中效果
电脑无缘无故黑屏,无法调节亮度。
R HISTOGRAM EXAMPLE QUICK REFERENCE
Functional interfaces and method references
Wechat applet uses Baidu API to achieve plant recognition
6方面带你认识LED软膜屏 LED软膜屏尺寸|价格|安装|应用
Liftover for genome coordinate conversion
【2022 ACTF-wp】
ros缺少xacro的包