Create the Dialog Box
Visual C++ provides many predesigned resources that you can incorporate into your projects. The default dialog box is one such resource. In this procedure, you’ll create a simple dialog box by starting with the default dialog box that the development environment provides.
To create the Pen Widths dialog box
With your Scribble project open, from the Insert menu, click Resource.
In the Insert Resource dialog box, select Dialog from the list of resource types and click OK.
Scribble’s ResourceView pane opens and the dialog editor window appears, displaying a default dialog box that contains two buttons labeled OK and Cancel. The Controls toolbar also appears.
If the property page is not displayed, right-click the dialog box, then click Properties on the menu. Click the pushpin on the property page to keep it open.
In the ID box, type
IDD_PEN_WIDTHS
.This is not a predefined ID, so you can’t select it from the drop-down list.
In the caption box, change the caption to
Pen Widths
.Notice that the title bar of the dialog box reflects the new caption.
Save your work.
Note The OK and Cancel buttons have predefined properties, including their command IDs — IDOK and IDCANCEL, respectively. If you click the OK button and switch to the Styles tab of the property page, you will see that the Default Button check box is checked.
In the next topic, you’ll add several controls to the default dialog box resource.