Jump to content

WinCreateDlg: Difference between revisions

From EDM2
Created page with "This function creates a dialog window. ==Syntax== WinCreateDlg(hwndParent, hwndOwner, pfnDlgProc, pdlgt, pCreateParams) ==Parameters== ; hwndParent (HWND) - input : Paren..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
This function creates a dialog window.  
This function creates a dialog window.


==Syntax==
==Syntax==
Line 5: Line 5:


==Parameters==
==Parameters==
; hwndParent (HWND) - input
;hwndParent (HWND) - input: Parent-window handle of the created dialog window.
: 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.


:;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==
==Returns==
; hwndDlg (HWND) - returns
;hwndDlg (HWND) - returns:Dialog-window handle.
:Dialog-window handle.
::NULLHANDLE - Dialog window not created
:;NULLHANDLE
::Other - Dialog-window handle.
::Dialog window not created  
:;Other
::Dialog-window handle.


==Remarks==
==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 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).  
This function should not be used while the pointing device capture is set (see [[WinSetCapture]]).
 
==Example Code==
==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.  
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.
<pre>
<pre>
#define INCL_WINDIALOGS        /* Window Dialog Mgr Functions  */
#define INCL_WINDIALOGS        /* Window Dialog Mgr Functions  */
Line 54: Line 37:
#define  ID_DIALOG  1
#define  ID_DIALOG  1


PDLGTEMPLATE pdlgt;    /* dialog template                     */
PDLGTEMPLATE pdlgt;    /* dialog template       */


DosGetResource(0L, RT_DIALOG, ID_DIALOG, (PVOID)pdlgt);
DosGetResource(0L, RT_DIALOG, ID_DIALOG, (PVOID)pdlgt);
Line 65: Line 48:
     pdlgt,      /* address of dialog structure */
     pdlgt,      /* address of dialog structure */
     NULL);      /* application-specific data  */
     NULL);      /* application-specific data  */
</pre>
Definition
<pre>
#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);
</pre>
</pre>


Line 89: Line 56:
* WinGetDlgMsg
* WinGetDlgMsg
* WinLoadDlg
* WinLoadDlg
* WinProcessDlg  
* WinProcessDlg


==Related Messages==
==Related Messages==

Revision as of 17:04, 5 April 2025

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

Related Functions

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

Related Messages

  • WM_INITDLG