Create a modal dialog box
In the create mode dialog box, call the member function of the cdialog class: domodal. The function is to create and display a module.
The function for closing the modal dialog box is enddialog, which requires a parameter domodal
The Return Value of the function.
Ctestdlg DLG;
DLG. domodal (); // open the Modal Dialog Box
DLG. enddialog (idok); // closes the modal dialog box, which is equivalent to clicking the "OK" button in the modal dialog box.
Create non-Modal Dialog Box
The create member function of the cdialog class is used to create a non-modal dialog box.
Bool create (maid, cwnd * pparentend = NULL );
Bool create (uint nidtemplate, cwnd * pparentwnd = NULL)
The first parameter of the create function can be the resource ID of the dialog box or the name of the dialog box template. The second parameter specifies
The parent window of the dialog box. If its value is null, the parent window of the dialog box is the main application window.
Ctestdlg DLG;
DLG. Create (idd_dialog1, this );
Note: when using the create function to create a non-modal dialog box, you also need to call the showwindow function to display the dialog box
. That is, you need to add DLG. showwindow (sw_show );