Realization of dialog box control and background variable value transfer in MFC

Now, we have a user interface login interface as follows:

We need to realize whether the password entered by the user is consistent with the pre-defined value in our background. When we click login, the password will be displayed in the edit box. If the password is consistent, the verification passed dialog box will pop up, and the verification failed dialog box will pop up if it is inconsistent.

1. First bind controls and variables in the class wizard, and let them associate

2. Add a message mapping for the login button in the class wizard, when you click the mouse, check the correctness of the password

3. In the message map we added, that is, the code is written in the created function

When we run the program, we can see that the data transfer is successfully realized between our dialog box and the variables in the background.

Guess you like

Origin blog.csdn.net/qq_25036849/article/details/108817256