CreateDialog

  HWND CreateDialog(hinst, lpszDlgTemp, hwndOwner, dlgprc)    
  HANDLE hinst; /* handle of application instance */
  LPTSTR lpszDlgTemp; /* address of dialog box template name */
  HWND hwndOwner; /* handle of owner window */
  DLGPROC dlgprc; /* instance address of dialog box procedure */

The CreateDialog function creates a modeless dialog box from a dialog box template resource.

Parameters

hinst

Identifies an instance of the module whose executable file contains the dialog box template.

lpszDlgTemp

Points to a null-terminated string that names the dialog box template.

hwndOwner

Identifies the window that owns the dialog box.

dlgprc

Specifies the procedure-instance 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 is the handle of the dialog box that was created, if the function is successful. Otherwise, it is NULL.

Comments

The CreateDialog 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).

The CreateWindowEx function is called to create the dialog box. The dialog box procedure then receives a WM_SETFONT message (if the DS_SETFONT style was specified), a WM_INITDIALOG message, and then the dialog box is displayed.

The CreateDialog function returns immediately after creating the dialog box.

To make the dialog box appear in the owner window upon being created, use the WS_VISIBLE style in the dialog box template.

Use the DestroyWindow function to destroy a dialog box created by the CreateDialog function.

A dialog box can contain up to 255 controls.

See Also

CreateDialogIndirect, CreateDialogIndirectParam, CreateDialogParam, DestroyWindow, MakeProcInstance