WinCreateDlg: Difference between revisions
Appearance
Created page with "This function creates a dialog window. ==Syntax== WinCreateDlg(hwndParent, hwndOwner, pfnDlgProc, pdlgt, pCreateParams) ==Parameters== ; hwndParent (HWND) - input : Paren..." |
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: 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== | ==Returns== | ||
; hwndDlg (HWND) - returns | ;hwndDlg (HWND) - returns:Dialog-window handle. | ||
:Dialog-window handle. | ::NULLHANDLE - 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> | </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