DIALOG Resource

This resource-definition statement specifies a window that an application can use to create dialog boxes. The statement defines the position and dimensions of the dialog box on the screen, as well as the dialog box style.

Syntax

nameID DIALOG x, y, width, height [[optional-statements]] { control-statement . . . }

Parameters

nameID

Identifies the dialog box. This is either a unique name or a unique 16-bit unsigned integer value in the range 1 to 65,535.

option-statements

Specifies options for the dialog box. It can be zero or more of the following statements:

Value Description
CAPTIONtext Specifies the caption of the dialog box if it has a title bar. For more information, see CAPTION.
CHARACTERISTICS dword Specifies a user-defined DWORD value for use by resource tools. This value is not used by the system. For more information, see CHARACTERISTICS.
CLASS class Specifies a 16-bit unsigned integer or a string, enclosed in double quotation marks (“), that identifies the class of the dialog box. For more information, see CLASS.
EXSTYLE=extended-styles Specifies the extended window style of the dialog box. For more information, see EXSTYLE.
FONT pointsize, typeface Specifies the point size and typeface for the font. For more information, see FONT.
LANGUAGE language,sublanguage Specifies the language of the dialog box. For more information, see LANGUAGE.
MENU menuname Specifies the menu to use. This value is either the name of the menu or its integer identifier.
STYLE styles Specifies the styles of the dialog box. For more information, see STYLE.
VERSION dword Specifies a user-defined DWORD value. This statement is intended for use by additional resource tools and is not used by the system. For more information, see VERSION.

Remarks

For more information about the x, y, width, and height parameters, see Common Control Parameters.

The GetDialogBaseUnits function returns the dialog base units in pixels. The exact meaning of the coordinates depends on the style defined by the STYLE option statement. For child-style dialog boxes, the coordinates are relative to the origin of the parent window, unless the dialog box has the style DS_ABSALIGN; in that case, the coordinates are relative to the origin of the display screen.

Do not use the WS_CHILD style with a modal dialog box because the DialogBox function always disables the parent or owner of the newly created dialog box. When a parent window is disabled, its child windows are disabled as well.

If a dialog box has the DS_ABSALIGN style, the coordinates for the upper-left corner of the dialog box are relative to the screen origin instead of to the upper-left corner of the parent window. You would typically use this style when you wanted the dialog box to start in a specific part of the display no matter where the parent window is on the screen.

To create a window with dialog box attributes, specify DIALOG as the class name parameter of the CreateWindow function.

Example

The following code example shows how to use the DIALOG statement.

#include <windows.h>

ErrorDialog DIALOG 10, 10, 300, 110
STYLE WS_POPUP | WS_BORDER
CAPTION "Error!" 
{
 CTEXT "Select One:", 1, 10, 10, 280, 12
 PUSHBUTTON "&Retry", 2, 75, 30, 60, 12
 PUSHBUTTON "&Abort", 3, 75, 50, 60, 12
 PUSHBUTTON "&Ignore", 4, 75, 80, 60, 12
} 
 

See Also

CONTROL, CreateDialog, CreateWindow, DialogBox, DIALOGEX, GetDialogBaseUnits, ACCELERATORS, CHARACTERISTICS, LANGUAGE, MENU, RCDATA, STRINGTABLE, VERSION