We recommend using Visual Studio 2017

Creating and Displaying Dialog Boxes

 

The latest version of this topic can be found at Creating and Displaying Dialog Boxes.

Creating a dialog object is a two-phase operation. First, construct the dialog object, then create the dialog window. Modal and modeless dialog boxes differ somewhat in the process used to create and display them. The following table lists how modal and modeless dialog boxes are normally constructed and displayed.

Dialog Creation

Dialog typeHow to create it
ModelessConstruct CDialog, then call Create member function.
ModalConstruct CDialog, then call DoModal member function.

You can, if you want, create your dialog box from an in-memory dialog template that you have constructed rather than from a dialog template resource. This is an advanced topic, however.

Life Cycle of a Dialog Box

Show: