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.

#define INCL_WINDIALOGS         /* Window Dialog Mgr Functions  */
#define INCL_DOSRESOURCES       /* OS/2 Resource functions      */
#include <os2.h>

PFNWP    MyDlgProc;
#define  ID_DIALOG  1

PDLGTEMPLATE pdlgt;     /* dialog template                      */

DosGetResource(0L, RT_DIALOG, ID_DIALOG, (PVOID)pdlgt);

/* make any changes to dialog template here */

WinCreateDlg(HWND_DESKTOP,
    NULLHANDLE,  /* owner window                */
    MyDlgProc,   /* address of dialog procedure */
    pdlgt,       /* address of dialog structure */
    NULL);       /* application-specific data   */


[Back] [Next]