Jump to content

WinCreateDlg

From EDM2
Revision as of 02:50, 13 May 2023 by Martini (talk | contribs) (Created page with "This function creates a dialog window. ==Syntax== WinCreateDlg(hwndParent, hwndOwner, pfnDlgProc, pdlgt, pCreateParams) ==Parameters== ; hwndParent (HWND) - input : Paren...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function creates a dialog window.

Syntax

WinCreateDlg(hwndParent, hwndOwner, pfnDlgProc, pdlgt, pCreateParams)

Parameters

hwndParent (HWND) - input
Parent-window handle of the created dialog window.
HWND_DESKTOP
The desktop window
HWND_OBJECT
Object window
Other
Specified window.
hwndOwner (HWND) - input
Requested owner-window handle of the created dialog window.
The actual owner window is calculated using the algorithm specified in the description of the WinLoadDlg function.
pfnDlgProc (PFNWP) - input
Dialog procedure for the created dialog window.
pdlgt (PDLGTEMPLATE) - input
Dialog template.
pCreateParams (PVOID) - input
Pointer to application-defined data area.
This is passed to the dialog procedure in the WM_INITDLG message.
This parameter MUST be a pointer rather than a long.

Returns

hwndDlg (HWND) - returns
Dialog-window handle.
NULLHANDLE
Dialog window not created
Other
Dialog-window handle.

Remarks

This function is identical to the WinLoadDlg call except that it creates a dialog window from pdlgt in memory, rather than a dialog template in a resource file.

This function should not be used while the pointing device capture is set (see WinSetCapture).

Example Code

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   */

Definition

#define INCL_WINDIALOGS /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND            hwndParent;     /*  Parent-window handle of the created dialog window. */
HWND            hwndOwner;      /*  Requested owner-window handle of the created dialog window. */
PFNWP           pfnDlgProc;     /*  Dialog procedure for the created dialog window. */
PDLGTEMPLATE    pdlgt;          /*  Dialog template. */
PVOID           pCreateParams;  /*  Pointer to application-defined data area. */
HWND            hwndDlg;        /*  Dialog-window handle. */

hwndDlg = WinCreateDlg(hwndParent, hwndOwner,
            pfnDlgProc, pdlgt, pCreateParams);

Related Functions

  • WinDefDlgProc
  • WinDismissDlg
  • WinDlgBox
  • WinGetDlgMsg
  • WinLoadDlg
  • WinProcessDlg

Related Messages

  • WM_INITDLG