VC++ Programming UESTC Chapter 7 The modeless dialog and Windows Common Dialogs What is a modeless dialog? o What's the difference between modal and modeless dialogs? What's the relationship between the dialog and the view window? o Why do we need to use user-defined message in modeless dialog o what are the common dialogs and how to use them?
VC++ Programming @ UESTC 1 Chapter 7 The Modeless Dialog and Windows Common Dialogs ⚫ What is a modeless dialog? ⚫ What’s the difference between modal and modeless dialogs? ⚫ What’s the relationship between the dialog and the view window? ⚫ Why do we need to use user-defined message in modeless dialog? ⚫ What are the common dialogs and how to use them?
VC++ Programming UESTC Chapter 7 The modeless dialog and Windows Common Dialogs e Modeless dialog allows user to work elsewhere in the application while the dialog is active Modal and modeless dialogs are derived from CDialog e Modal dialog can be constructed on the stack and so it is easy to be cleaned up Modeless dialog is more complicated
VC++ Programming @ UESTC 2 ⚫ Modeless dialog allows user to work elsewhere in the application while the dialog is active. ⚫ Modal and modeless dialogs are derived from CDialog. ⚫ Modal dialog can be constructed on the stack and so it is easy to be cleaned up. ⚫ Modeless dialog is more complicated. Chapter 7 The Modeless Dialog and Windows Common Dialogs
VC++ Programming UESTC Chapter 7 The modeless dialog and Windows Common Dialogs Difference between creating a modal dialog and a modele dialog Modal Modeless Constructor used Constructor with Defaul resource ID constructor(no param param) Function used to DoModal Create with create window resource ID param 3
VC++ Programming @ UESTC 3 Difference between creating a modal dialog and a modeless dialog Modal Modeless Constructor used Constructor with resource ID param Default constructor (no param) Function used to create window DoModal Create with resource ID param Chapter 7 The Modeless Dialog and Windows Common Dialogs
VC++ Programming@UESTC Chapter 7 The modeless dialog and Windows Common Dialogs Created takes the resource ID as parameter and returns immediately with the dialog window still on the e screen o Programmer must determine the all actions for the modeless dialog such as creation, destroy and processing of user-entered data o C++ compiler distinguish modal and modeless dialog by looking at the Cexo7aDialog(C view*)or CEX07aDialog(C Wnd=)
VC++ Programming @ UESTC 4 ⚫ Create() takes the resource ID as parameter and returns immediately with the dialog window still on the screen. ⚫ Programmer must determine the all actions for the modeless dialog such as creation, destroy and processing of user-entered data. ⚫ C++ compiler distinguish modal and modeless dialog by looking at the CEx07aDialog(CView*) or CEx07aDialog(CWnd*) Chapter 7 The Modeless Dialog and Windows Common Dialogs
VC++ Programming@UESTC Chapter 7 The modeless dialog and Windows Common Dialogs o The view needs to know when to destroy the modeles dialog window e Usually a user-defined message is sent to the view after the user click the ok button on the modeless dialog Then the view destroy the dialog window but the dialog c++ class may still be there ● User-defined message #define WM GOodBYE Wm user+5
VC++ Programming @ UESTC 5 ⚫ The view needs to know when to destroy the modeless dialog window. ⚫ Usually a user-defined message is sent to the view after the user click the OK button on the modeless dialog. ⚫ Then the view destroy the dialog window but the dialog c++ class may still be there. ⚫ User-defined message #define WM_GOODBYE WM_USER+5 Chapter 7 The Modeless Dialog and Windows Common Dialogs