win12.hlp (Table of Contents; Topic list)
WinCreateDlg (1.2)
Function Group  Overview  Message Group         Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINDIALOGS
 
HWND WinCreateDlg(hwndParent, hwndOwner, pfnDlgProc, pdlgt,
    pCreateParams)
HWND hwndParent;        /* handle of the parent window               */
HWND hwndOwner;         /* handle of the owner window                */
PFNWP pfnDlgProc;       /* address of dialog procedure               */
PDLGTEMPLATE pdlgt;     /* address of structure with dialog template */
PVOID pCreateParams;    /* address of application-specific data      */
 
The WinCreateDlg function creates a dialog window from a dialog template in
memory. This function works like the WinLoadDlg function, which creates a
dialog window from a dialog template in a resource.
 
Parameter      Description
────────────────────────────────────────────────────────────────────────────
 
hwndParent     Identifies the parent window.
 
hwndOwner      Identifies the owner window.
 
pfnDlgProc     Points to the dialog procedure.
 
pdlgt          Points to the DLGTEMPLATE structure that contains the dialog
               template.
 
pCreateParams  Contains application-specific data that is passed to the
               dialog procedure as part of the WM_INITDLG message.
 
Return Value
 
The return value is the handle of the dialog window that was created, or
NULL if an error occurred.
 
Example
 
This example loads a dialog template from the application's resources and
uses the template with the WinCreateDlg function to create a dialog window.
This example is identical to calling the WinLoadDlg function, but gives the
application the advantage of reviewing and modifying the dialog template
before creating the dialog window.
 
SEL sel;
PDLGTEMPLATE pdlgt;
 
DosGetResource((HMODULE) NULL, RT_DIALOG, ID_DIALOG, &sel);
pdlgt = MAKEP(sel, 0);    /* convert resource to structure pointer */
 
/* make any changes to dialog template here */
 
WinCreateDlg(HWND_DESKTOP,
    (HWND) NULL,      /* owner window                */
    MyDlgProc,        /* address of dialog procedure */
    pdlgt,            /* address of dialog structure */
    (PVOID) NULL);    /* application-specific data   */
DosFreeSeg(sel);      /* free the memory             */
 
See Also
 
DosGetResource, WinDlgBox, WinLoadDlg, WinProcessDlg, DLGTEMPLATE,
WM_INITDLG