DIALOG resource

Defines a dialog box. The statement defines the position and dimensions of the dialog box on the screen as well as the dialog box style.

Note

DIALOG is an obsolete resource ID. New applications should use DIALOGEX.

 

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

Parameters

nameID

Unique name or a unique 16-bit unsigned integer value that identifies the dialog box.

optional-statements

Options for the dialog box. This can be zero or more of the following statements.

Statement Description
CAPTION "text" Caption of the dialog box if it has a title bar. For more information, see CAPTION.
CHARACTERISTICS dword User-defined DWORD value for use by resource tools. This value is not used by the system. For more information, see CHARACTERISTICS.
CLASS class 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 Extended window style of the dialog box. For more information, see EXSTYLE.
FONT pointsize, typeface Point size and typeface for the font. For more information, see FONT.
LANGUAGE language, sublanguage Language of the dialog box. For more information, see LANGUAGE.
MENU menuname Menu to be used. This value is either the name of the menu or its integer identifier.
STYLE styles Styles of the dialog box. For more information, see STYLE.
VERSION dword 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.

 

Certain attributes are also supported for backward compatibility. For more information, see Common Resource Attributes.

Remarks

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. The DialogBox function always disables the parent/owner of the newly created dialog box. When a parent window is disabled, its child windows are implicitly disabled. Since the parent window of the child-style dialog box is disabled, the child-style dialog box is too.

If a dialog box has the DS_ABSALIGN style, the dialog coordinates for its upper-left corner 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 may be on the screen.

The name DIALOG can also be used as the class-name parameter to the CreateWindow function to create a window with dialog-box attributes.

Examples

The following demonstrates the usage of 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

Using Dialog Boxes

ACCELERATORS

CHARACTERISTICS

CONTROL

CreateDialog

CreateWindow

DialogBox

GetDialogBaseUnits

LANGUAGE

MENU

RCDATA

STRINGTABLE

VERSION