CreateDialogParam

3.0

  HWND CreateDialogParam(hinst, lpszDlgTemp, hwndOwner, dlgprc, lParamInit)    
  HINSTANCE hinst; /* handle of application instance */
  LPCSTR lpszDlgTemp; /* address of name of dialog box template */
  HWND hwndOwner; /* handle of owner window */
  DLGPROC dlgprc; /* instance address of dialog box procedure */
  LPARAM lParamInit; /* initialization value */

The CreateDialogParam function creates a modeless dialog box from a dialog box template resource. Before displaying the dialog box, the function passes an application-defined value to the dialog box procedure as the lParam parameter of the WM_INITDIALOG message. An application can use this value to initialize dialog box controls.

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. The address must be created by using the MakeProcInstance function. For more information about the dialog box procedure, see the description of the DialogProc callback function.

lParamInit

Specifies the value to pass to the dialog box when processing the WM_INITDIALOG message.

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 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) and a WM_INITDIALOG message, and then the dialog box is displayed.

The CreateDialogParam 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.

A dialog box can contain up to 255 controls.

Example

The following example uses the CreateDialogParam function to create a modeless dialog box. The function passes the application-defined flags MIXEDCASE and WHOLEWORD, which will be received by the dialog box as the lParam parameter of the WM_INITDIALOG message.

HWND hwndChangeBox;
DLGPROC dlgprc = (DLGPROC) MakeProcInstance(ChangeDlgProc, hinst);

hwndChangeBox = CreateDialogParam(hinst, "dlgFindBox",
    hwndParent, dlgprc, MIXEDCASE | WHOLEWORD);

See Also

CreateDialog, CreateDialogIndirect, CreateDialogIndirectParam, DestroyWindow