当前位置:网站首页>Vs2019 use wizard to generate an MFC Application

Vs2019 use wizard to generate an MFC Application

2022-07-06 11:24:00 imxlw00

Create project

choice mfc Templates
 Insert picture description here

Configuration items

 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here

function

 Insert picture description here

Class view

 Insert picture description here
Double click the class name to jump to the class declaration .h file
 Insert picture description here
The following is the member function in the class , Double click to jump to the corresponding definition section

 Insert picture description here

Addition of message processing

 Insert picture description here
stay CMainFrame Add message processing , The program didn't respond , Need to be in view Layer operates the above process .
Find... In the message list WM_LBUTTONDOWN news , add to .
Add several changes to the engineering documents .
First of all : Add the function declaration of the left mouse button message function in the framework class header file  Insert picture description here
The second place : In the framework class cpp The message mapping macro... Is added to the file
 Insert picture description here
The third place : In the frame column cpp The function definition for processing the left mouse button message is added to the file
 Insert picture description here


void CMFCTestView::OnLButtonDown(UINT nFlags, CPoint point)
{
    
	// TODO:  Add message handler code and / Or call the default value 

	CView::OnLButtonDown(nFlags, point);
	CString str;
	str.Format(TEXT("x=%d , y=%d "), point.x, point.y);
	MessageBox(str);
}

 Insert picture description here

原网站

版权声明
本文为[imxlw00]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060912503552.html