- Using MFC to create modal dialog boxes
Modal dialogs are divided into two types, modal dialogs implemented using the API, and modal dialogs implemented using MFC.
As an example:
This is because the modal dialog box masks messages from other forms .
We create a new project. Then create a dialog box:
Our goal is to click the button in the first dialog box, and the second dialog box pops up. Double-click the button:
Note that the name of the member function here is renamed according to the button's ID number.
Then add the class to the newly added dialog box, and we can either right-add the class or double-click to add the class.
Back to the solution, you can see the Mymodaldialog cpp and H files appear:
We then added the code to the first dialog button. When adding code, first add the header file:
Alt+b Press R again, recompile, and run. After clicking the button to open Modaldialog, click elsewhere and there will be no corresponding:
Windows Programming Progressive--dialog box application