Windows Systems Programming: Spring 2002

[ Home | Syllabus | Course Notes | Assignments | Search]


Dialog Boxes

Although it is possible to use a dialog as the main window of an application, most dialog boxes are child windows. 

Two critical questions any software designer should ask are:

  1. Which object should remember this information (state)
  2. Which object is responsible for making this happen. (action)

Three Simple Dialog

To illustrate some of the difficulties in building a good dialog box and the advantage of reusing CDialog object from the MFC library and the use of the Resource/Dialog Editor and Class Wizard, I present three versions of a simple dialog to ask the user for a new title for the main window.

  1. Version one does not use CDialog, but builds the dialog in the main window itself. This is not a good solution but it does clearly illustrate the communications between CEdit and CButton controls.

  2. Version two uses CDialog and the Dialog editor and illustrates how to incorporate a resource compiler generated dialog into your program. Illustrates passing of data from Edit to MainWindow.

  3. Version three uses the app and class wizard and most closely follows the example in the book. Hopefully some the magic going on behind the scenes will make sense.

 


Communication Solutions

 

 

 

 


Copyright chris wild 1999-2002.
For problems or questions regarding this web contact [Dr. Wild].
Last updated: February 05, 2002.