The DIALOGS.DLG File

When you save a dialog, one of the files the Dialog Editor writes is the .DLG file. This text file contains the information in the .RES file expressed as resource script statements. Each dialog is described in a sequence of statements called a "template."

When you create a dialog in the editor, it has a unique ID number, which becomes a handle to the template. When you want to create an instance of the dialog in your application, you pass this handle to the system in a call to the DialogBox function. The system does the rest. Here's a typical .DLG script file containing two simple dialogs:

100 DIALOG 6, 16, 148, 84
STYLE DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | NOT WS_BORDER | WS_POPUP
CAPTION "Invert"
BEGIN
    PUSHBUTTON      "Push This", 101, 54, 30, 40, 14, 
END

200 DIALOG 6, 16, 148, 84
STYLE DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | NOT WS_BORDER | WS_POPUP
CAPTION "Reverse"
BEGIN
    PUSHBUTTON      "Push That", 101, 43, 30, 40, 14, 
END
 

The handles to the two dialogs are 100 and 200. You can also define a corresponding symbolic name for a dialog in the editor. It's easier to use a name than a number in your code.

The Dialog Editor cannot read the DIALOGS.DLG file. The data is saved and read from the .RES file.