DialogBox

  int DialogBox(hinst, lpTemplateName, hwndOwner, dlgprc)    
  HANDLE hinst; /* handle of application instance */
  LPCTSTR lpTemplateName; /* identifies dialog box template */
  HWND hwndOwner; /* handle of owner window */
  DLGPROC dlgprc; /* address of dialog box procedure */

This function creates a modal dialog box that has the size, style, and controls specified by the dialog-box template given by the lpTemplateName parameter. The hwndOwner parameter identifies the application window that owns the dialog box. The callback function pointed to by the dlgprc parameter processes any messages received by the dialog box.

The DialogBox function does not return control until the callback function terminates the modal dialog box by calling the EndDialog function.

Parameters

hinst

Identifies the module that contains the dialog template resource. GetModuleHandle(NULL) can be called to return the module handle of the current process.

lpTemplateName

Identifies the dialog-box template. This parameter can consist of the template identifier in the low word and zero in the high word. The MAKEINTRESOURCE macro can be used to create this value. Alternatively, this parameter can point to a null-terminated character string that names the dialog-box template.

hwndOwner

Identifies the window that owns the dialog box.

dlgprc

Specifies the address of the dialog box procedure. For more information about the dialog box procedure, see the description of the DialogProc callback function.

Return Value

The return value specifies the value of the nResult parameter in the EndDialog function that is used to terminate the dialog box. Values returned by the application's dialog box are processed by Windows and are not returned to the application. The return value is -1 if the function could not create the dialog box.

Comments

The DialogBox function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

CreateDialog, CreateDialogIndirect, CreateDialogParam, CreateDialogIndirectParam, DialogBoxParam, DialogBoxIndirectParam, DialogProc, EndDialog, GetDC