当前位置:网站首页>[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
边栏推荐
- HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
- SSRF
- Seriation in R: How to Optimally Order Objects in a Data Matrice
- Attribute acquisition method and operation notes of C # multidimensional array
- JS——每次调用从数组里面随机取一个数,且不能与上一次为同一个
- How to Create a Nice Box and Whisker Plot in R
- Redis exceeds the maximum memory error oom command not allowed when used memory & gt; ' maxmemory'
- liftOver进行基因组坐标转换
- 八大排序汇总
- spritejs
猜你喜欢
Esp32 stores the distribution network information +led displays the distribution network status + press the key to clear the distribution network information (source code attached)
解决uniapp列表快速滑动页面数据空白问题
Amazon cloud technology community builder application window opens
【2022 ACTF-wp】
Jinshanyun - 2023 Summer Internship
Three transparent LED displays that were "crowded" in 2022
数字化转型挂帅复产复工,线上线下全融合重建商业逻辑
Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?
The selected cells in Excel form have the selection effect of cross shading
Mmrotate rotation target detection framework usage record
随机推荐
BEAUTIFUL GGPLOT VENN DIAGRAM WITH R
原生方法合并word
LVM operation
tidb-dm报警DM_sync_process_exists_with_error排查
MySQL比较运算符IN问题求解
ros gazebo相关包的安装
vant tabs组件选中第一个下划线位置异常
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
PowerBI中导出数据方法汇总
Research on and off the Oracle chain
mysql 基本语句
GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
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?
What are the methods of adding elements to arrays in JS
Verilog and VHDL signed and unsigned number correlation operations
VS2019代码中包含中文内容导致的编译错误和打印输出乱码问题
对毕业季即将踏入职场的年轻人的一点建议
Order by injection
qt 仪表自定义控件
A white hole formed by antineutrons produced by particle accelerators