A dialog box is a pop-up window that an application uses to display or prompt for information—typically, information needed to complete a command. A dialog box contains one or more controls with which the user can type text, choose options, and direct the action of a particular command.
You have seen a dialog box already in the Generic application: the About dialog box. This dialog box contains static text controls that provide information about the application, and a push button control that the user can use to close the dialog box and return to the main window. To process a dialog box, you need to supply a dialog box template, a dialog box procedure, and some means to call the dialog box.
A dialog box template is text that describes the dialog box and the controls it contains. You can use either a text editor or Windows Dialog Editor (DLGEDIT.EXE) to create the template. Once you have created the template, you add it to your resource-definition file.
A dialog box procedure is a callback function; Windows calls the dialog box procedure and passes it messages for the dialog box. Although a dialog box procedure is similar to a window procedure, Windows carries out special processing for dialog boxes. Therefore, the dialog box procedure does not have the same responsibilities as a window procedure.
The most common way to display a dialog box is in response to menu input. For example, the Open command on the File menu requires additional information to complete its task; it displays a dialog box to prompt for the additional information.
There are two types of dialog box: modal and modeless.