WinCreateDlg: Difference between revisions
Appearance
mNo edit summary |
|||
(One intermediate revision by the same user not shown) | |||
Line 51: | Line 51: | ||
==Related Functions== | ==Related Functions== | ||
* WinDefDlgProc | * [[WinDefDlgProc]] | ||
* WinDismissDlg | * [[WinDismissDlg]] | ||
* WinDlgBox | * [[WinDlgBox]] | ||
* WinGetDlgMsg | * [[WinGetDlgMsg]] | ||
* WinLoadDlg | * [[WinLoadDlg]] | ||
* WinProcessDlg | * [[WinProcessDlg]] | ||
==Related Messages== | ==Related Messages== | ||
* WM_INITDLG | * [[WM_INITDLG]] | ||
[[Category:Win]] | [[Category:Win]] |
Latest revision as of 18:49, 14 May 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 */