Jump to content

WinDlgBox: Difference between revisions

From EDM2
No edit summary
Line 30: Line 30:
;''ulResult'' ([[ULONG]]) - returns: Reply value.
;''ulResult'' ([[ULONG]]) - returns: Reply value.
:Value established by the [[WinDismissDlg]] call or DID\_ERROR if an error occurs.
:Value established by the [[WinDismissDlg]] call or DID\_ERROR if an error occurs.
==Errors==
Possible returns from [[WinGetLastError]]
;PMERR_INVALID_HWND (0x1001)
:An invalid window handle was specified.
;PMERR_INVALID_INTEGER_ATOM (0x1016)
:The specified atom is not a valid integer atom.
;PMERR_INVALID_ATOM_NAME (0x1015)
:An invalid atom name string was passed.
;PMERR_ATOM_NAME_NOT_FOUND (0x1017)
:The specified atom name is not in the atom table.
;PMERR_RESOURCE_NOT_FOUND (0x100A)
:The specified resource identity could not be found.


== Remarks ==
== Remarks ==

Revision as of 15:46, 15 May 2025

This function loads and processes a modal dialog window and returns the result value established by the WinDismissDlg call.

Syntax

WinDlgBox(hwndParent, hwndOwner,pfnDlgProc, hmod, idDlg, 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.
hmod (HMODULE) - input
Resource identity containing the dialog template.
NULLHANDLE: Use the application's .EXE file.
Other: Module handle returned from the DosLoadModule or DosQueryModuleHandle call.
idDlg (ULONG) - input
Dialog-template identity within the resource file.
It is also used as the identity of the created dialog window. It must be greater than or equal to 0 and less than or equal to 0xFFFF.
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

ulResult (ULONG) - returns
Reply value.
Value established by the WinDismissDlg call or DID\_ERROR if an error occurs.

Errors

Possible returns from WinGetLastError

PMERR_INVALID_HWND (0x1001)
An invalid window handle was specified.
PMERR_INVALID_INTEGER_ATOM (0x1016)
The specified atom is not a valid integer atom.
PMERR_INVALID_ATOM_NAME (0x1015)
An invalid atom name string was passed.
PMERR_ATOM_NAME_NOT_FOUND (0x1017)
The specified atom name is not in the atom table.
PMERR_RESOURCE_NOT_FOUND (0x100A)
The specified resource identity could not be found.

Remarks

The use of parameters for this function is the same as those of the WinLoadDlg function.

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

This function does not return until WinDismissDlg is called.

Example Code

Declaration:

#define INCL_WINDIALOGS /* Or use INCL_WIN, INCL_PM, Also in COMMON section */
#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. */
HMODULE  hmod;          /* Resource identity containing the dialog template. */
ULONG    idDlg;         /* Dialog-template identity within the resource file. */
PVOID    pCreateParams; /* Pointer to application-defined data area. */
ULONG    ulResult;      /* Reply value. */

ulResult = WinDlgBox(hwndParent, hwndOwner,
                     pfnDlgProc, hmod, idDlg, pCreateParams);