MFC problem of handling the login box

1. In doing login box when the log modal dialog box is made, and before the main interface program is located on the window opens. Ie to the InitInstance () in the main interface class. Doing so will pop up before the main interface is modal login box pops up out of the box blocked live.

1. However, press enter, it will trigger the next login box if you are in edit mode in EditControl login box of OnOK function, so as not to judge a user name and password to log directly closed the modal dialog box pops up the main interface.
Way to avoid that: in the login box override the virtual function: OnOK, comment out this function inside.
2. When you click a red cross when the sign-in box will close login box, pops up the main interface directly, not to perform the login logic, and x is the purpose of our Click to exit the entire program process, to avoid the method is: Register Login WM_CLOSE message box, and in the first line of the message write: exit (1);
3. Log button logic, mainly logical judgment is true, you should write: CDialogEx :: OnOK ();
4. To achieve the Enter login, if it is registered WM_CHAR messages, I can not be completed, the correct approach is to rewrite the login box:
detailed:
So login is done.
Cancel button to directly write: exit (1); on the line.

Guess you like

Origin www.cnblogs.com/HelloQLQ/p/12625734.html