CreateDialogIndirect

  HWND CreateDialogIndirect(hinst, lpDialogTemplate, hwndOwner, dlgprc)    
  HANDLE hinst; /* handle of application instance */
  LPDLGTEMPLATESTUB lpDialogTemplate; /* address of template */
  HWND hwndOwner; /* handle of owner window */
  DLGPROC dlgprc; /* instance address of dialog proc */

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

The CreateDialogIndirect function sends a WM_INITDIALOG message to the dialog function before displaying the dialog box. This message allows the dialog function to initialize the dialog-box controls.

CreateDialogIndirect returns immediately after creating the dialog box. It does not wait for the dialog box to begin processing input.

Parameters

hinst

Identifies the module creating the dialog. GetModuleHandle(NULL) can be called to return the module handle of the current process.

lpDialogTemplate

Points to a block of memory that contains a DLGTEMPLATE data structure.

hwndOwner

Identifies the window that owns the dialog box.

dlgprc

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

Return Value

The return value is the window handle of the dialog box. It is NULL if the function cannot create either the dialog box or any controls in the dialog box.

Comments

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

Use the WS_VISIBLE style in the dialog-box template if the dialog box should appear in the parent window upon creation.

See Also

DefWindowProc, SetFocus, CreateDialog, CreateDialogParam, CreateDialogIndirectParam, DialogBoxParam, DialogBoxIndirectParam