Resources and Controls
If a dialog box is simply a window, what makes it different from the CView windows you've seen already? For one thing, a dialog box is almost always tied to a Windows resource that identifies the dialog box's elements and specifies their layout. Because you can use the dialog editor (one of the resource editors) to create and edit a dialog resource, you can quickly and efficiently produce dialog boxes in a visual manner.A dialog box contains a number of elements called controls. Dialog controls include edit controls (text boxes), buttons, list boxes, combo boxes, static text (labels), tree views, progress indicators, and sliders. Windows manages these controls using special grouping and tabbing logic, and that relieves you of a major programming burden. The dialog controls can be referenced either by a CWnd pointer (because they are really windows) or by an index number (with an associated #define constant) assigned in the resource. A control sends a message to its parent dialog box in response to a user action such as typing text or clicking a button.The Microsoft Foundation Class (MFC) library and Microsoft Visual Studio work together to enhance the dialog logic that Windows provides. Visual Studio can generate a class derived from CDialog and lets you associate dialog class data members with dialog controls. You can specify editing parameters such as maximum text length and numeric high and low limits. Visual Studio generates statements that call the MFC data exchange and data validation functions to move information back and forth between the screen and the data members.